Java Hour Format formatDateTime(java.util.Date date)

Here you can find the source of formatDateTime(java.util.Date date)

Description

format Date Time

License

Open Source License

Declaration

public static String formatDateTime(java.util.Date date) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    public final static String DEFAULT_DATE_FROMAT = "yyyyMMddHHmmss";

    public static String formatDateTime(java.util.Date date) {
        return formatDateTime(DEFAULT_DATE_FROMAT, date);
    }/* w  ww .  j  a  v  a  2s  .c  om*/

    public static String formatDateTime(String pattern, java.util.Date date) {
        String strDate = null;
        String strFormat = pattern;
        SimpleDateFormat dateFormat = null;

        if (date == null)
            return "";

        dateFormat = new SimpleDateFormat(strFormat);
        strDate = dateFormat.format(date);

        return strDate;
    }
}

Related

  1. formatDateTime(final Calendar cal)
  2. formatDateTime(final Date dat)
  3. formatDateTime(final Date date)
  4. formatDateTime(java.util.Date d)
  5. formatDateTime(java.util.Date date)
  6. formatDateTime(java.util.Date paramDate)
  7. formatDateTime(String date)
  8. FormatDateTime(String dateString)
  9. formatDateTime(String dateTime)