@Immutable public final class PDTWebDateHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static DateTimeFormatter |
XSD_DATE_TIME |
| Modifier and Type | Method and Description |
|---|---|
static WithZoneId |
extractDateTimeZone(String sDate)
Extract the time zone from the passed string.
|
static String |
getAsStringRFC822(LocalDateTime aDateTime)
create a RFC822 representation of a date time using UTC date time zone.
|
static String |
getAsStringRFC822(OffsetDateTime aDateTime)
create a RFC822 representation of a date.
|
static String |
getAsStringRFC822(ZonedDateTime aDateTime)
create a RFC822 representation of a date.
|
static String |
getAsStringW3C(LocalDateTime aDateTime)
create a W3C Date Time representation of a date.
|
static String |
getAsStringW3C(OffsetDateTime aDateTime)
create a W3C Date Time representation of a date time using UTC date time
zone.
|
static String |
getAsStringW3C(ZonedDateTime aDateTime)
create a W3C Date Time representation of a date time using UTC date time
zone.
|
static String |
getAsStringXSD(LocalDate aLD) |
static String |
getAsStringXSD(LocalDateTime aLDT) |
static String |
getAsStringXSD(ZonedDateTime aZDT) |
static String |
getAsStringXSD(ZoneId aZoneID,
ZonedDateTime aZDT) |
static String |
getCurrentDateTimeAsStringRFC822() |
static String |
getCurrentDateTimeAsStringW3C() |
static ZonedDateTime |
getDateTimeFromRFC822(String sDate)
Parses a Date out of a String with a date in RFC822 format.
|
static OffsetDateTime |
getDateTimeFromW3C(String sDate)
Parses a Date out of a String with a date in W3C date-time format.
|
static ZonedDateTime |
getDateTimeFromW3COrRFC822(String sDate)
Parses a Date out of a String with a date in W3C date-time format or in a
RFC822 format.
|
static ZonedDateTime |
getDateTimeFromXSD(String sValue) |
static ZonedDateTime |
getDateTimeFromXSD(String sValue,
ZoneId aZoneID) |
static LocalDate |
getLocalDateFromXSD(String sValue) |
static LocalDateTime |
getLocalDateTimeFromW3COrRFC822(String sDate)
Parses a Date out of a String with a date in W3C date-time format or in a
RFC822 format.
|
static LocalDateTime |
getLocalDateTimeFromXSD(String sValue) |
static DateTimeFormatter |
getXSDFormatterDate() |
static DateTimeFormatter |
getXSDFormatterDateTime(ZoneId aZoneID) |
static OffsetDateTime |
parseOffsetDateTimeUsingMask(PDTMask<?>[] aMasks,
String sDate)
Parses a Date out of a string using an array of masks.
|
static ZonedDateTime |
parseZonedDateTimeUsingMask(PDTMask<?>[] aMasks,
String sDate,
ZoneId aDTZ)
Parses a Date out of a string using an array of masks.
|
public static final DateTimeFormatter XSD_DATE_TIME
@Nullable public static OffsetDateTime parseOffsetDateTimeUsingMask(@Nonnull PDTMask<?>[] aMasks, @Nonnull @Nonempty String sDate)
aMasks - array of masks to use for parsing the stringsDate - string to parse for a date.@Nullable public static ZonedDateTime parseZonedDateTimeUsingMask(@Nonnull PDTMask<?>[] aMasks, @Nonnull @Nonempty String sDate, @Nullable ZoneId aDTZ)
aMasks - array of masks to use for parsing the stringsDate - string to parse for a date.aDTZ - The date/time zone to use. Optional.@Nonnull public static WithZoneId extractDateTimeZone(@Nonnull String sDate)
sDate - The date string.null WithZoneId, where the remaining
string to be parsed (never null) and and the extracted
time zone (may be null) are contained.@Nullable public static ZonedDateTime getDateTimeFromRFC822(@Nullable String sDate)
Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element.
sDate - string to parse for a date. May be null.ZonedDateTime or if the passed String was
null.@Nullable public static OffsetDateTime getDateTimeFromW3C(@Nullable String sDate)
Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element.
sDate - string to parse for a date. May be null.ZonedDateTime or if the input string was null.@Nullable public static ZonedDateTime getDateTimeFromW3COrRFC822(@Nullable String sDate)
sDate - string to parse for a date.@Nullable public static LocalDateTime getLocalDateTimeFromW3COrRFC822(@Nullable String sDate)
sDate - string to parse for a date.@Nullable public static String getAsStringRFC822(@Nullable ZonedDateTime aDateTime)
aDateTime - Date to print. May be null.null if the
parameter is null.@Nullable public static String getAsStringRFC822(@Nullable OffsetDateTime aDateTime)
aDateTime - Date to print. May be null.null if the
parameter is null.@Nullable public static String getAsStringRFC822(@Nullable LocalDateTime aDateTime)
aDateTime - Date to print. May be null.null if the
parameter is null.@Nullable public static String getAsStringW3C(@Nullable ZonedDateTime aDateTime)
aDateTime - Date to print. May not be null.@Nullable public static String getAsStringW3C(@Nullable OffsetDateTime aDateTime)
aDateTime - Date to print. May not be null.@Nullable public static String getAsStringW3C(@Nullable LocalDateTime aDateTime)
aDateTime - Date to print. May not be null.@Nonnull public static String getCurrentDateTimeAsStringRFC822()
@Nonnull public static String getCurrentDateTimeAsStringW3C()
@Nonnull public static DateTimeFormatter getXSDFormatterDateTime(@Nonnull ZoneId aZoneID)
@Nullable public static ZonedDateTime getDateTimeFromXSD(@Nullable String sValue)
@Nullable public static ZonedDateTime getDateTimeFromXSD(@Nullable String sValue, @Nonnull ZoneId aZoneID)
@Nullable public static LocalDateTime getLocalDateTimeFromXSD(@Nullable String sValue)
@Nullable public static String getAsStringXSD(@Nullable ZonedDateTime aZDT)
@Nullable public static String getAsStringXSD(@Nonnull ZoneId aZoneID, @Nullable ZonedDateTime aZDT)
@Nullable public static String getAsStringXSD(@Nullable LocalDateTime aLDT)
@Nonnull public static DateTimeFormatter getXSDFormatterDate()
Copyright © 2014–2017 Philip Helger. All rights reserved.