Here you can find the source of getCurDateTimeFormat(String Format)
public static String getCurDateTimeFormat(String Format)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Main { public static String getCurDateTimeFormat(String Format) { Calendar now = Calendar.getInstance(TimeZone.getDefault()); DateFormat sdf = new SimpleDateFormat(Format); sdf.setTimeZone(TimeZone.getDefault()); return (sdf.format(now.getTime())); }//w w w . j a v a 2 s . com }