Class ExpandedDate
- java.lang.Object
-
- com.identityworksllc.iiq.common.plugin.vo.ExpandedDate
-
public class ExpandedDate extends Object
A VO class to wrap a date in a known format, allowing clients to consume it however they wish.
-
-
Constructor Summary
Constructors Constructor Description ExpandedDate(Instant instant)Constructs a new ExpandedDate by treating the Instant as a Date with millisecond precision.ExpandedDate(LocalDate in)Constructs a new ExpandedDate from the given LocalDate.ExpandedDate(LocalDateTime date)Constructs a new ExpandedDate by converting the given LocalDateTime to an epoch instant in the system time zone.ExpandedDate(ZonedDateTime date)Constructs a new ExpandedDate by converting the given ZonedDateTime to an epoch instant.ExpandedDate(Date in)Constructs a new ExpandedDate from the given input date
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDate()StringgetServerTimeZoneId()StringgetServerTimeZoneName()longgetTimestamp()StringtoString()
-
-
-
Constructor Detail
-
ExpandedDate
public ExpandedDate(LocalDate in)
Constructs a new ExpandedDate from the given LocalDate.In this case, the formatted date will be in the ISO8601 local date standard of yyyy-MM-dd. The timestamp will be set to local midnight in the system time zone.
- Parameters:
in- The date to convert
-
ExpandedDate
public ExpandedDate(ZonedDateTime date)
Constructs a new ExpandedDate by converting the given ZonedDateTime to an epoch instant.- Parameters:
date- The date to convert
-
ExpandedDate
public ExpandedDate(LocalDateTime date)
Constructs a new ExpandedDate by converting the given LocalDateTime to an epoch instant in the system time zone.- Parameters:
date- The local date time
-
ExpandedDate
public ExpandedDate(Instant instant)
Constructs a new ExpandedDate by treating the Instant as a Date with millisecond precision.This is technically a loss of precision, as Instant values are more precise than Date values.
- Parameters:
instant- The instant to convert to an ExpandedDate
-
ExpandedDate
public ExpandedDate(Date in)
Constructs a new ExpandedDate from the given input date- Parameters:
in- The input date, not null
-
-
Method Detail
-
getServerTimeZoneId
public String getServerTimeZoneId()
- Returns:
- the server time zone ID according to
ZoneId.getId()
-
getServerTimeZoneName
public String getServerTimeZoneName()
- Returns:
- the server time zone ID according to
ZoneId.getDisplayName(TextStyle, Locale)}, with a text style ofTextStyle.SHORTand a locale ofLocale.US.
-
getTimestamp
public long getTimestamp()
- Returns:
- the timestamp as a millisecond Unix epoch offset
-
-