Here you can find the source of currentTime()
public static String currentTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String currentTime() { return reformattedTime(System.currentTimeMillis()); }/* w w w .j a v a 2 s . c om*/ /** * Takes the milliseconds and converts it to the formatted time * @param milliSeconds * @return the date */ public static String reformattedTime(long milliSeconds) { String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(milliSeconds)); String[] dates = date.split(" "); date = dates[0] + "T" + dates[1]; return date; } }