Here you can find the source of now()
public static Date now()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*w w w . j a v a 2 s .co m*/ * Returns the current system date */ public static Date now() { return new Date(); } /** * Returns the current system date as string with the specified format */ public static String now(String pattern) { return new SimpleDateFormat(pattern).format(now()); } }