Here you can find the source of getCurrentDateTime()
public static Date getCurrentDateTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static Date getCurrentDateTime() { return Calendar.getInstance().getTime(); }//from w w w. j ava2 s .c o m public static String getTime() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(currentTime); String min; min = dateString.substring(14, 16); return min; } }