@Immutable public class JQueryDatePickerFormat extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
assertValidParseFormat()
Same as
isValidParseFormat(), but throws if it is not valid. |
String |
format(Instant instant,
ZoneId zoneId)
Formats the given instant in the given time zone according to the settings of this instance.
|
String |
format(LocalDate date,
ZoneId zoneId)
Formats the given instant in the given time zone according to the settings of this instance.
|
String |
format(ZonedDateTime dateTime)
Formats the given instant in the given time zone according to the settings of this instance.
|
String |
getFormatString() |
boolean |
isValidParseFormat() |
ZonedDateTime |
parse(String dateToParse,
ZoneId zoneId)
Parses a date string with the current options.
|
Instant |
parseInstant(String dateToParse,
ZoneId zoneId)
Parses a date string with the current options.
|
static JQueryDatePickerFormat |
withJsonConfig(com.alibaba.fastjson.JSONObject json,
String formatString)
Creates a new JQuery datepicker format for the given locale and format string.
|
static JQueryDatePickerFormat |
withLocale(Locale locale,
String formatString)
Creates a new JQuery datepicker format for the given locale and format string.
|
public void assertValidParseFormat()
throws IllegalStateException
isValidParseFormat(), but throws if it is not valid.IllegalStateException - When the format is not valid for parsing.public String format(Instant instant, ZoneId zoneId)
instant - Instance to format.zoneId - Time zone to use for time zone dependent fields.public String format(LocalDate date, ZoneId zoneId)
date - Date to format.zoneId - Time zone to use for time zone dependent fields.public String format(ZonedDateTime dateTime)
dateTime - The date time to format.public String getFormatString()
public boolean isValidParseFormat()
false, parse(String, ZoneId) will throw an exception. so make sure to check beforehand.public ZonedDateTime parse(String dateToParse, ZoneId zoneId) throws DateTimeException, IllegalArgumentException
dateToParse - A date string to parse.zoneId - Time zone to use.DateTimeException - When the date to parse is semantically invalid (such as when the month or day is out of
range).IllegalArgumentException - When the date to parse is syntactically invalid.IllegalStateException - When isValidParseFormat() returns false.public Instant parseInstant(String dateToParse, ZoneId zoneId)
dateToParse - A date string to parse.zoneId - Time zone to use.public static JQueryDatePickerFormat withJsonConfig(com.alibaba.fastjson.JSONObject json, String formatString)
json - JSON with day and month names to use, in the format as defined by the JQuery datepicker.formatString - Format string to use.public static JQueryDatePickerFormat withLocale(Locale locale, String formatString)
locale - Locale to use.formatString - Format string to use.Copyright © 2020 XIMA MEDIA GmbH. All rights reserved.