Java Date Now getCurrentMonthStartTime()

Here you can find the source of getCurrentMonthStartTime()

Description

get Current Month Start Time

License

Apache License

Declaration

public static String getCurrentMonthStartTime() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

import java.text.SimpleDateFormat;

public class Main {
    public static final String simple = "yyyy-MM-dd HH:mm:ss";

    public static String getCurrentMonthStartTime() {
        Calendar c = Calendar.getInstance(Locale.CHINA);
        String now = null;/*  w  w w.  ja  va 2s .c o m*/
        c.setTime(new Date());
        c.set(Calendar.MONTH, c.get(Calendar.MONTH));
        c.set(Calendar.DAY_OF_MONTH, +1);
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        SimpleDateFormat df = new SimpleDateFormat(simple);
        now = df.format(c.getTime());
        return now;
    }
}

Related

  1. getCurrentMonth()
  2. getCurrentMonth()
  3. getCurrentMonth(boolean bool, String currentDate)
  4. getCurrentMonthday()
  5. getCurrentMonthLastDay()
  6. getCurrentMonthString(Calendar calendar)
  7. getCurrentODSDate()
  8. getCurrentPlainDate()
  9. getCurrentQuarter()