|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<SupportedDateFormat>
pl.edu.agh.cast.data.model.common.SupportedDateFormat
public enum SupportedDateFormat
Defines date formats and provides basic methods for parsing and formating dates.
Supported date formats:
For more details about defining date formats see SimpleDateFormat
Enum Constant Summary | |
---|---|
RRRR_MM_DD_DASH
yyyy-MM-dd format. |
|
RRRR_MM_DD_DOT
yyyy.MM.dd format e.g. |
|
RRRR_MM_DD_SLASH
yyyy/MM/dd format. |
Method Summary | |
---|---|
String |
format(Date date)
Formats given date. |
static String |
formatDefault(Date date)
Formats date using the default format: dd-mm-yyyy. |
static String |
getDefaultFormat()
Returns the default date format. |
String |
getFormat()
Returns the date format. |
static Date |
parse(String text)
Parsed given text according to all supported formats. |
static SupportedDateFormat |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static SupportedDateFormat[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final SupportedDateFormat RRRR_MM_DD_DASH
public static final SupportedDateFormat RRRR_MM_DD_SLASH
public static final SupportedDateFormat RRRR_MM_DD_DOT
Method Detail |
---|
public static SupportedDateFormat[] values()
for (SupportedDateFormat c : SupportedDateFormat.values()) System.out.println(c);
public static SupportedDateFormat valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static Date parse(String text) throws ParseException
text
- text to parse.
ParseException
- if text does not match to any format. exception generated by the last format is thrownpublic static String formatDefault(Date date)
date
- date to format
public String format(Date date)
date
- date to format
public String getFormat()
public static String getDefaultFormat()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |