Here you can find the source of getCurrentDateTime()
public static String getCurrentDateTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd hh:mm:ss"; public static String getCurrentDateTime() { SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT); return sdf.format(new Date()); }// ww w .j a va 2 s .co m }