Java Parse Date parseDate2String(Date date)

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

Description

parse Date String

License

Open Source License

Declaration

public static String parseDate2String(Date date) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static final String PATTERN = "yyyy-MM-dd";

    public static String parseDate2String(Date date, String pattern) {
        return getSimpleDateFormatInstance(pattern).format(date);
    }//from   w w w .  ja v  a2 s  .  c  o  m

    public static String parseDate2String(Date date) {
        return parseDate2String(date, null);
    }

    private static SimpleDateFormat getSimpleDateFormatInstance(String pattern) {
        return new SimpleDateFormat(pattern == null ? PATTERN : pattern);
    }
}

Related

  1. parseDate(String value)
  2. parseDate(String value)
  3. parseDate(String value, Class targetType, String... formats)
  4. parseDate(String value, String formater)
  5. parseDate(String value, String pattern)
  6. parseDate4UrlCreateTime(String dateStr)
  7. parseDateAllowNull(String date)
  8. parseDateAndGetLong(String date)
  9. parseDateAsString(Date value)