Java Date Format dateTimeFormatterDate(Date date)

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

Description

date Time Formatter Date

License

Open Source License

Declaration

public static String dateTimeFormatterDate(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    private static String defaultDatePattern = "yyyy-MM-dd";
    public static SimpleDateFormat dateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String dateTimeFormatterDate(Date date) {
        if (date != null) {
            return dateTimeFormatter.format(date);
        }/*from  w  w  w .  j  av a  2s . c o m*/
        return "";
    }

    public static String format(Date date) {
        return format(date, getDatePattern());
    }

    public static String format(Date date, String pattern) {
        String returnValue = "";

        if (date != null) {
            SimpleDateFormat df = new SimpleDateFormat(pattern);
            returnValue = df.format(date);
        }

        return (returnValue);
    }

    public static String getDatePattern() {
        return defaultDatePattern;
    }
}

Related

  1. dateTime2Str(Date date, String pattern)
  2. dateTime2String(Date value)
  3. dateTime2StringFs(Date date)
  4. dateTimeFormat(Date dateTime)
  5. DateTimeFormat(final Date date)
  6. dateTimeToMillis(String dateTime, String format)
  7. dateTimeToStr(Date date, String format)
  8. dateTimeToZuluFormat(DateTime dateTime)
  9. formatD(Date date)