Here you can find the source of getYearMonthDay(Date date)
public static String getYearMonthDay(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String FORMAT12 = "yyyyMMdd"; public static String getYearMonthDay(Date date) { SimpleDateFormat formatter = new SimpleDateFormat(FORMAT12); String currentTime = formatter.format(date); return currentTime; }/*w w w . j a va 2 s . c o m*/ }