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.*; public class Main { private static String defaultDatePattern = "yyyy-MM-dd"; public static SimpleDateFormat dateTimeFormatter2 = new SimpleDateFormat("yyyyMMddHHmmss"); public static String getNowStr() { return dateTimeFormatter2.format(new Date()); }/* www . ja va2 s . c o m*/ public static String format(Date date) { return format(date, getDatePattern()); } public static String format(Date date, String pattern) { String returnValue = ""; if (date != null) { SimpleDateFormat df = new SimpleDateFormat(pattern); returnValue = df.format(date); } return (returnValue); } public static String getDatePattern() { return defaultDatePattern; } }