Here you can find the source of now()
public static String now()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static final String FORMAT = "yyyyMMdd_HHmm"; /**//from w w w.ja v a2s . c o m * Get today date and current time in format: yyyyMMdd_HHmm. * * * @return current date and time in format yyyyMMdd_HHmm */ public static String now() { final Calendar calendar = Calendar.getInstance(); final SimpleDateFormat formatter = new SimpleDateFormat(FORMAT); return formatter.format(calendar.getTime()); } }