Here you can find the source of nowDateString(String format)
public static String nowDateString(String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String nowDateString() { return nowDateString("yyyy.MM.dd HH:mm:ss"); }/*from www.j av a 2 s . co m*/ /** * Return a string formatted as format * * @return String formatted for right now */ public static String nowDateString(String format) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(new Date()); } }