Here you can find the source of getShortFirstDayOfMonth()
public static String getShortFirstDayOfMonth()
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public final static String shortFormat = "yyyyMMdd"; public static String getShortFirstDayOfMonth() { Calendar cal = Calendar.getInstance(); Date dt = new Date(); cal.setTime(dt);/*from ww w .j a v a 2 s .c o m*/ cal.set(Calendar.DAY_OF_MONTH, 1); DateFormat df = getNewDateFormat(shortFormat); return df.format(cal.getTime()); } public static DateFormat getNewDateFormat(String pattern) { DateFormat df = new SimpleDateFormat(pattern); df.setLenient(false); return df; } public static String format(Date date, String format) { if (date == null) { return null; } return new SimpleDateFormat(format).format(date); } }