Here you can find the source of getNowStr()
public static String getNowStr()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String NORMAL_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static String getNowStr() { return dateToStr(); }/* w w w. j av a 2s . c om*/ public static String dateToStr(Date date) { if (date == null) { return ""; } return dateToString(date, NORMAL_PATTERN); } public static String dateToStr() { return dateToStr(new Date()); } public static String dateToString(Date date, String pattern) { if (date == null) { date = new Date(); } SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(date); } @Deprecated public static String dateToString(Date date) { return dateToStr(date); } }