Here you can find the source of formatNow(String fmt)
public static String formatNow(String fmt)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatNow(String fmt) { return formatDate(new Date(), fmt); }//w w w . j ava 2 s . c om public static String formatDate(Object date, String fmt) { if (date == null) { return null; } if (!(date instanceof Date)) { return date.toString(); } SimpleDateFormat sdf = new SimpleDateFormat(fmt); return sdf.format(date); } }