Here you can find the source of formateDate2yyyyMMdd()
public static String formateDate2yyyyMMdd()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from w ww. j a v a2 s .c o m * pattern "yyyyMMdd""20160322" */ private static final String YYYYMMDD = "yyyyMMdd"; public static String formateDate2yyyyMMdd() { return formateCurrentDate2String(YYYYMMDD); } private static String formateCurrentDate2String(String pattern) { Date date = new Date(); return new SimpleDateFormat(pattern).format(date); } }