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