Here you can find the source of getYearMonthDay()
public static String getYearMonthDay()
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { private static final Calendar CALENDAR = Calendar.getInstance(); public static String getYearMonthDay() { CALENDAR.setTime(new Date()); int year = CALENDAR.get(Calendar.YEAR); int month = CALENDAR.get(Calendar.MONTH) + 1; return year + "" + month; }/* w w w .j a v a2 s . c om*/ }