Here you can find the source of parseDate(Date date)
Parameter | Description |
---|---|
date | The Date to parse. |
public static String parseDate(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { /**//from ww w . j ava2 s .c o m * The storage format for parsing dates. */ public static final String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; /** * Parses a Date to a string using {@link #DATE_STORAGE_FORMAT}. * * <p> * The default storage format is config-friendly, so it may be used in YamlConfig.</p> * <p> * Parsing <i>null</i> returns "never".</p> * * @param date The Date to parse. * @return The parsed String. * @see #parseString(String) */ public static String parseDate(Date date) { if (date == null) { return "never"; } return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).format(date); } }