Here you can find the source of now()
public static String now()
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/* ww w . j a v a 2s . com*/ */ public static String now() { String DATE_FORMAT = "dd.MM.yyyy HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); Date date = new Date(); return sdf.format(date); } }