Here you can find the source of getCurrentMonthStartTime()
public static String getCurrentMonthStartTime()
//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; } }