Here you can find the source of getCurrentTime(String format)
public static String getCurrentTime(String format)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.SimpleTimeZone; public class Main { public static String getCurrentTime(String format) { //1hour(ms) = 60s * 60m * 1000ms int millisPerHour = 60 * 60 * 1000; SimpleDateFormat fmt = new SimpleDateFormat(format); SimpleTimeZone timeZone = new SimpleTimeZone(9 * millisPerHour, "KST"); fmt.setTimeZone(timeZone);/*from w w w. j a v a2 s . c o m*/ String str = fmt.format(new java.util.Date(System.currentTimeMillis())); return str; } public static String getCurrentTime() { return getCurrentTime("yyyy-MM-dd HH:mm:ss"); } }