Here you can find the source of getThisMonthStart()
public static String getThisMonthStart()
//package com.java2s; import java.util.*; public class Main { public static String getThisMonthStart() { String strY = null;/*from w w w. j a va 2 s . c o m*/ Calendar localTime = Calendar.getInstance(); int x = localTime.get(Calendar.YEAR); int y = localTime.get(Calendar.MONTH) + 1; strY = y >= 10 ? String.valueOf(y) : ("0" + y); return x + "-" + strY + "-01"; } }