java.lang.Object
is.codion.common.format.LocaleDateTimePattern
- All Implemented Interfaces:
Serializable
Specifies a locale sensitive numerical date format pattern.
Note that the time part is 24 hour based and is not locale sensitive.
Orders the year and month parts according to locale, with two-digit month and day parts and two or four digit year.
LocaleDateTimePattern pattern = LocaleDateTimePattern.builder()
.delimiterDash()
.yearFourDigits()
.hoursMinutes()
.build();
Locale iceland = new Locale("is", "IS");
Locale us = new Locale("en", "US");
pattern.datePattern(iceland); // "dd-MM-yyyy"
pattern.datePattern(us); // "MM-dd-yyyy"
pattern.dateTimePattern(iceland);// "dd-MM-yyyy HH:mm"
pattern.dateTimePattern(us) ;// "MM-dd-yyyy HH:mm"
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<String> The default date format pattern Value type: String Default value: dd-MM-yyyy [month/day order is locale specific]static final PropertyValue<String> The default date/time format pattern Value type: String Default value: dd-MM-yyyy HH:mm [month/day order is locale specific]static final PropertyValue<String> The default date format pattern Value type: String Default value: HH:mm -
Method Summary
Modifier and TypeMethodDescriptionbuilder()datePattern(Locale locale) dateTimePattern(Locale locale)
-
Field Details
-
TIME_PATTERN
The default date format pattern- Value type: String
- Default value: HH:mm
-
DATE_PATTERN
The default date format pattern- Value type: String
- Default value: dd-MM-yyyy [month/day order is locale specific]
-
DATE_TIME_PATTERN
The default date/time format pattern- Value type: String
- Default value: dd-MM-yyyy HH:mm [month/day order is locale specific]
-
-
Method Details
-
timePattern
- Returns:
- the time part of this format, an empty Optional if none is available
-
datePattern
- Returns:
- the date part of this format using the default Locale
-
dateTimePattern
- Returns:
- the date and time (if available) parts of this format using the default Locale
-
datePattern
- Parameters:
locale- the locale- Returns:
- the date part of this format
-
dateTimePattern
- Parameters:
locale- the locale- Returns:
- the date and time (if available) parts of this format
-
formatter
- Returns:
- a new
DateTimeFormatterinstance based on this pattern
-
builder
- Returns:
- a new Builder for a
LocaleDateTimePattern.
-