Here you can find the source of getTime(String format)
public static String getTime(String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static SimpleDateFormat sdf = new SimpleDateFormat(); public static String getTime(String format) { return formatDate(new Date(), format); }//from w w w .j a va2s. c o m public static String formatDate(Date date, String formater) { sdf.applyPattern(formater); return sdf.format(date); } }