public enum DateFormats extends Enum<DateFormats>
Enum Constant and Description |
---|
COOKIE_DATE_FORMATS |
DEFAULT_DATE_FORMATS |
DEFAULT_DATE_FORMATS_SHORT |
Modifier and Type | Method and Description |
---|---|
DateTimeFormatter[] |
getDateFormats() |
Date |
toDate(String aDateString)
Creates a date from the provided
String using the date formats as
retrieved by the getDateFormats() method. |
static DateFormats |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DateFormats[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DateFormats DEFAULT_DATE_FORMATS
public static final DateFormats DEFAULT_DATE_FORMATS_SHORT
public static final DateFormats COOKIE_DATE_FORMATS
public static DateFormats[] values()
for (DateFormats c : DateFormats.values()) System.out.println(c);
public static DateFormats valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic DateTimeFormatter[] getDateFormats()
public Date toDate(String aDateString) throws DateTimeException
String
using the date formats as
retrieved by the getDateFormats()
method. If one date format
fails, then the next one is used to parse the date text.aDateString
- The date text to be converted to a Date
instance.Date
instance as of the date text.ParseException
- Thrown in case parsing the date text was not
possible.DateTimeException
Copyright © 2016. All rights reserved.