Here you can find the source of toDate()
public static String toDate()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static SimpleDateFormat daysParse = new SimpleDateFormat("yyyyMMdd"); public static String toDate() { Date date = new Date(); return daysParse.format(date); }//from w w w. jav a2 s . c o m }