Here you can find the source of timeToDate()
public static String timeToDate()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String timeToDate() { Calendar cal = Calendar.getInstance(); SimpleDateFormat dateParser = new SimpleDateFormat("MMM d HH:mm:ss", Locale.getDefault()); return dateParser.format(cal.getTime()); }//w ww. ja v a2 s.c o m }