Here you can find the source of calNow()
public static String calNow()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static final String DATE_FORMAT_NOW = "yyyy-MM-dd hh:mm:ss"; /**//from w ww .j a va 2s . c o m * @return the formatted current {@linkplain Calendar} */ public static String calNow() { return calFormat(Calendar.getInstance()); } /** * Formats a {@linkplain Calendar} to the application wide format for * date/time * * @param cal * the {@linkplain Calendar} to format * @return the formated {@linkplain Calendar} */ public static String calFormat(final Calendar cal) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); return sdf.format(cal.getTime()); } }