Java Hour Format formatAllDate(Date date)

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

Description

format All Date

License

Open Source License

Declaration

public static String formatAllDate(Date date) 

Method Source Code


//package com.java2s;

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

public class Main {
    public static String defaultDatePattern = "yyyy-MM-dd";
    public static String defaultDatePattern1 = "yyyy-MM-dd HH:mm:ss";

    public static String formatAllDate(Date date) {
        return format(date, defaultDatePattern1);
    }// w  w w  .j a  v  a2  s  .  c  o m

    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. format1StringToformat2String(String dateStr)
  2. format2NormalTime(Date date)
  3. format_default(Date time)
  4. formatAbsoluteTime(long time)
  5. formatAddTime(Date addTime)
  6. formatAsCassandraDateTime(Date date)
  7. formatAsDateAndTime(Date date)
  8. formatAsHour(long l)
  9. formatAsRoundTripDate(Date date)