Here you can find the source of getYearMonthDate()
public static String getYearMonthDate()
//package com.java2s; /*//w w w . j av a 2 s . c o m * K4M, License, Version 1.1 * * Copyright (c) 2000 K4M. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are prohibited. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getYearMonthDate() { return new SimpleDateFormat("yyyyMMdd").format(new Date()); } public static String getYearMonthDate(long date) { return new SimpleDateFormat("yyyyMMdd").format(new Date(date)); } }