Here you can find the source of formatDateTime()
public static String formatDateTime()
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static DateFormat m_ISO8601Local = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); public static String formatDateTime() { return formatDateTime(new Date(System.currentTimeMillis())); }/*from w ww. j a va 2s . c om*/ public static String formatDateTime(Date date) { if (date == null) { return formatDateTime(new Date(System.currentTimeMillis())); } String dateStr = m_ISO8601Local.format(date); return dateStr; } }