Android Date to String Convert getLongFormat(Date date)

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

Description

get Long Format

Declaration

public static String getLongFormat(Date date) 

Method Source Code

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main{
    public static final String LOCAL_LONG_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static String getLongFormat(Date date) {
        if (date == null) {
            return null;
        }/*  www.java  2s .  c  o m*/
        return getFormatString(date, LOCAL_LONG_DATE_FORMAT);
    }
    public static String getFormatString(Date date, String dateFormat) {
        if (date == null || StringUtil.isEmpty(dateFormat)) {
            return null;
        }

        return new SimpleDateFormat(dateFormat, Locale.ENGLISH)
                .format(date);
    }
}

Related

  1. getDateTimeString(Date date, int format, Locale currentLocale)
  2. getFileName()
  3. getFormatString(Date date, String dateFormat)
  4. getHourInFloat(Date date)
  5. getLongDateStr(Date date)
  6. getShortDateTimeString(Date date)
  7. getShortFormat(Date date)
  8. getStringFromDate(Date date)
  9. javaDateToIso8601(Date date)