Here you can find the source of getCurrentDateInyyyyMMddFormat()
public static String getCurrentDateInyyyyMMddFormat()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { private static final String DATE_PATTERN_YYYYMMDD = "yyyyMMdd"; public static String getCurrentDateInyyyyMMddFormat() { Date date = new Date(); return convertDateToString(date, DATE_PATTERN_YYYYMMDD); }/*from ww w . ja v a 2 s .c om*/ public static String convertDateToString(Date date, String patternString) { return convertDateToString(date, patternString, Locale.getDefault()); } public static String convertDateToString(Date date, String patternString, Locale locale) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(patternString, locale); return simpleDateFormat.format(date); } }