Java Hour Format formatDateTime()

Here you can find the source of formatDateTime()

Description

format Date Time

License

Open Source License

Declaration

public static String formatDateTime() 

Method Source Code

//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;
    }
}

Related

  1. formatDateInTime(Date date)
  2. formatDateRfc822(Date date, String timeZoneId)
  3. formatDateString(Date d)
  4. formatDateString(String dateString)
  5. formatDateString2(String str_date)
  6. formatDateTime(Calendar cal)
  7. formatDateTime(Calendar dateTime)
  8. formatDateTime(Calendar time)
  9. formatDateTime(Date d)