Enum DateFormat
- java.lang.Object
-
- java.lang.Enum<DateFormat>
-
- org.cyclos.model.system.languages.DateFormat
-
- All Implemented Interfaces:
Serializable,Comparable<DateFormat>,HasMessageKey
public enum DateFormat extends Enum<DateFormat> implements HasMessageKey
Possible formats for dates
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DMY_DASHDMY_PERIODDMY_SLASHMDY_DASHMDY_PERIODMDY_SLASHYMD_DASHYMD_PERIODYMD_SLASH
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(DateTime dateTime)StringformatRelative(DateTime referenceDateTime, DateTime dateTime)Formats a dateTime based on a referenceDateTime.static DateFormatforOrderAndSeparator(String order, char separator)Returns the format for the given fields order (which may be "DMY", "MDY" or "YMD") and separator char, or throwsIllegalArgumentExceptionif there's no matchMessageKeygetMessageKey()StringgetPattern()static DateFormatvalueOf(String name)Returns the enum constant of this type with the specified name.static DateFormat[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DMY_SLASH
public static final DateFormat DMY_SLASH
-
DMY_DASH
public static final DateFormat DMY_DASH
-
DMY_PERIOD
public static final DateFormat DMY_PERIOD
-
MDY_SLASH
public static final DateFormat MDY_SLASH
-
MDY_DASH
public static final DateFormat MDY_DASH
-
MDY_PERIOD
public static final DateFormat MDY_PERIOD
-
YMD_SLASH
public static final DateFormat YMD_SLASH
-
YMD_DASH
public static final DateFormat YMD_DASH
-
YMD_PERIOD
public static final DateFormat YMD_PERIOD
-
-
Method Detail
-
values
public static DateFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DateFormat c : DateFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DateFormat valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
forOrderAndSeparator
public static DateFormat forOrderAndSeparator(String order, char separator)
Returns the format for the given fields order (which may be "DMY", "MDY" or "YMD") and separator char, or throwsIllegalArgumentExceptionif there's no match
-
formatRelative
public String formatRelative(DateTime referenceDateTime, DateTime dateTime)
Formats a dateTime based on a referenceDateTime. If the reference date time has the same year as the date time then the year won't be displayed.
-
getMessageKey
public MessageKey getMessageKey()
- Specified by:
getMessageKeyin interfaceHasMessageKey
-
getPattern
public String getPattern()
-
-