Here you can find the source of getNow()
public static Date getNow()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getNow() { return new Date(); }//from w w w . jav a 2s.com public static String getNow(String pattern) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); return simpleDateFormat.format(new Date()); } public static String format(Date date, String pattern) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); return simpleDateFormat.format(date); } }