Java Date Format As fmtDate(Date date)

Here you can find the source of fmtDate(Date date)

Description

fmt Date

License

Open Source License

Declaration

public static String fmtDate(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.util.Date;

import java.util.Locale;

public class Main {

    public static String fmtDate(Date date) {
        if (null == date) {
            return null;
        }/*  w  w w .j  a  va2s .c o m*/
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(
                    "yyyy-MM-dd HH:mm:ss", Locale.US);
            return sdf.format(date);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. fmt(double num, int minIntDigits, int maxFracDigitis)
  2. fmt(long count)
  3. fmt(String pattern, Object... args)
  4. fmtBdToString(BigDecimal bd, DecimalFormat df)
  5. fmtDate(Date date)
  6. fmtDateTime(final Date dateTime, final String simpleDateTimeFormat)
  7. fmtMsg(final String fmt, final String arg)
  8. fmtNumStringToDouble(String s)
  9. fmtTime(Date time)