java.lang.Object
com.pervasive.datarush.tokens.scalar.DateTimeUtils
Utilities for working with date/time values.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic longepochDaysToMillis(long epochDays, ZoneId zoneId) Gets the instant in time at midnight in the specified time zone corresponding to the given date.static Stringformat(DateValued value) Converts a date value into an ISO8601 date formatted string.static Stringformat(TimestampValued value) Converts a time stamp value into an ISO8601 time stamp formatted string.static Stringformat(TimeValued value) Converts a time of day value into an ISO8601 time formatted string.static StringformatDaysSinceEpoch(long epochDays) Converts a date, expressed as days, into an ISO8601 date formatted string.static StringformatEpochTime(long seconds, int nanos, int offsetSecs) Converts a time stamp, expressed as component values, into an ISO8601 time stamp formatted string.static StringformatMillisSinceMidnight(int dayMillis) Converts a time of day, expressed as milliseconds, into an ISO8601 time formatted string.static ZoneIdstatic intlocalTimeToSeconds(LocalTime localTime) Gets the instant in time on January 1, 1970 in the default time zone corresponding to the given time of day.static StringmillisToTextValue(TemporalField field, ZonedDateTime zdt) Gets the value - day, month, year, hour, minutes, seconds etc ChronoField values represented by the given Zoned Date Timestatic intmillisToValue(TemporalField field, ZonedDateTime zdt) Gets the value - day, month, year, hour, minutes, seconds etc ChronoField values represented by the given Zoned Date Timestatic intnormalizeMillisSinceMidnight(long millis) Normalize elapsed milliseconds to the standard range from midnight to midnight.protected static intparseIntField(String str, int startPos, int endPos) static voidparseInto(String text, DateSettable buffer) Parses a date in ISO8601 format, storing the result into a date valued container.static voidparseInto(String text, TimeSettable buffer) Parses a time of day in ISO8601 time format, storing the result into a time valued container.static voidparseInto(String text, TimestampSettable buffer) Parses a timestamp in ISO8601 format, storing the result into a timestamp valued container.static intparseTimeFields(String str, com.pervasive.datarush.tokens.scalar.DateTimeUtils.TimeParsingContext ctx, int pos) static longparseToDaysSinceEpoch(String text) Parses a date in ISO8601 time format into days since epoch.static intParses a time of day in ISO8601 time format into milliseconds since midnight.static LocalDatetoDate(long epochDays) Gets the instant in time at midnight in the default time zone corresponding to the given date.static LocalDateGets the instant in time at midnight in the specified time zone corresponding to the given date.static longtoDaysSinceEpoch(int year, int monthOfYear, int dayOfMonth) Gets the specified date as days since epoch.static longtoDaysSinceEpoch(long millis) Gets the date represented by the given instant in the default time zone as days since epoch.static longtoDaysSinceEpoch(long millis, ZoneId zoneId) Gets the date represented by the given instant in the specified time zone as days since epoch.static longtoDaysSinceEpoch(LocalDate localDate) Gets the date represented by the given instant in the default time zone as days since epoch.static longtoDaysSinceEpoch(Date date) Gets the date represented by the given instant in the default time zone as days since epoch.static longtoDaysSinceEpoch(Date date, ZoneId zoneId) Gets the date represented by the given instant in the specified time zone as days since epoch.static voidtoEpochTime(long millis, TimestampSettable buffer) Stores the given instant into a time stamp buffer using the default time zone for the offset.static voidtoEpochTime(long millis, ZoneId zoneId, TimestampSettable buffer) Stores the given instant into a time stamp buffer using the specified time zone for the offset.static voidtoEpochTime(Timestamp timestamp, TimestampSettable buffer) Stores the given instant into a time stamp buffer using the default time zone for the offset.static voidtoEpochTime(Timestamp timestamp, ZoneId zoneId, TimestampSettable buffer) Stores the given instant into a time stamp buffer using the specified time zone for the offset.static voidtoEpochTime(Date date, TimestampSettable buffer) Stores the given instant into a time stamp buffer using the default time zone for the offset.static voidtoEpochTime(Date date, ZoneId zoneId, TimestampSettable buffer) Stores the given instant into a time stamp buffer using the specified time zone for the offset.static LocalDatetoLocalDate(long milliSec) static inttoMillisSinceMidnight(int hourOfDay, int minuteOfHour, int secondOfMinute) Gets the time, in 24-hour format, as milliseconds since midnight.static inttoMillisSinceMidnight(long instant) Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.static inttoMillisSinceMidnight(long instant, int offset) Gets the time of day represented by the given instant in the specified time zone as milliseconds since midnight.static inttoMillisSinceMidnight(long millis, ZoneId zoneId) Gets the time of day represented by the given instant in the specified time zone as milliseconds since midnight.static inttoMillisSinceMidnight(LocalDate localDate) Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.static inttoMillisSinceMidnight(LocalDate localDate, ZoneId zoneId) Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.static inttoMillisSinceMidnight(Date time) Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.static inttoMillisSinceMidnight(Date time, ZoneId zoneId) Gets the time of day represented by the given instant in the specified time zone as milliseconds since midnight.static LocalTimetoTime(long dayMillis) Gets the instant in time on January 1, 1970 in the default time zone corresponding to the given time of day.static TimestamptoTimestamp(long epochSecs, int subsecNanos, int offsetSecs) Gets the instant in time on corresponding to the specified epoch time.static voidwithCSTTimeZone(Runnable runnable)
-
Field Details
-
CST_TIMEZONE
-
-
Method Details
-
parseIntField
-
parseTimeFields
public static int parseTimeFields(String str, com.pervasive.datarush.tokens.scalar.DateTimeUtils.TimeParsingContext ctx, int pos) -
millisToTextValue
Gets the value - day, month, year, hour, minutes, seconds etc ChronoField values represented by the given Zoned Date Time- Parameters:
field- the TemporalFieldzdt- the ZonedDateTime- Returns:
- value of the field represented by the supplied ZonedDateTime
-
millisToValue
Gets the value - day, month, year, hour, minutes, seconds etc ChronoField values represented by the given Zoned Date Time- Parameters:
field- the TemporalFieldzdt- the ZonedDateTime- Returns:
- value of the field represented by the supplied ZonedDateTime
-
toDaysSinceEpoch
public static long toDaysSinceEpoch(int year, int monthOfYear, int dayOfMonth) Gets the specified date as days since epoch.- Parameters:
year- the year portion of the datemonthOfYear- the month portion of the date. Months are counted as on a calendar, starting with 1 for January.dayOfMonth- the day portion of the date- Returns:
- the number of days elapsed since January 1, 1970
-
toDaysSinceEpoch
Gets the date represented by the given instant in the default time zone as days since epoch.- Parameters:
date- the instant in time to convert- Returns:
- the number of days elapsed since January 1, 1970
-
toDaysSinceEpoch
Gets the date represented by the given instant in the specified time zone as days since epoch.- Parameters:
date- the instant in time to convertzoneId- the time zone relative to which to interpret the instant- Returns:
- the number of days elapsed since January 1, 1970
-
toDaysSinceEpoch
public static long toDaysSinceEpoch(long millis) Gets the date represented by the given instant in the default time zone as days since epoch.- Parameters:
millis- the instant in time to convert- Returns:
- the number of days elapsed since January 1, 1970
-
toDaysSinceEpoch
Gets the date represented by the given instant in the specified time zone as days since epoch.- Parameters:
millis- the instant in time to convertzoneId- the time zone id relative to which to interpret the instant- Returns:
- the number of days elapsed since January 1, 1970
-
toDaysSinceEpoch
Gets the date represented by the given instant in the default time zone as days since epoch.- Parameters:
date- the instant in time to convert- Returns:
- the number of days elapsed since January 1, 1970
-
epochDaysToMillis
Gets the instant in time at midnight in the specified time zone corresponding to the given date.- Parameters:
epochDays- the number of milliseconds elapsed since January 1, 1970zoneId- the time zone id relative to which to convert the date- Returns:
- the resulting instant in time as milliseconds in epoch
-
toDate
Gets the instant in time at midnight in the default time zone corresponding to the given date.- Parameters:
epochDays- the number of milliseconds elapsed since January 1, 1970- Returns:
- a
LocalDateobject representing the date
-
toDate
Gets the instant in time at midnight in the specified time zone corresponding to the given date.- Parameters:
epochDays- the number of milliseconds elapsed since January 1, 1970zoneId- the time zone id relative to which to convert the date- Returns:
- a
LocalDateobject representing the date
-
toLocalDate
-
parseToDaysSinceEpoch
Parses a date in ISO8601 time format into days since epoch.- Parameters:
text- a date in ISO8601 format- Returns:
- the number of days elapsed since January 1, 1970
-
parseInto
Parses a date in ISO8601 format, storing the result into a date valued container. The empty string is parsed as a null value.- Parameters:
text- a date in ISO8601 format.buffer- the container in which to store the parsed value
-
formatDaysSinceEpoch
Converts a date, expressed as days, into an ISO8601 date formatted string.- Parameters:
epochDays- the number of days elapsed since January 1, 1970- Returns:
- the date in ISO8601 format
-
format
Converts a date value into an ISO8601 date formatted string.- Parameters:
value- the date value to convert- Returns:
- the date in ISO8601 format. If the input is null valued, the empty string is returned.
-
normalizeMillisSinceMidnight
public static int normalizeMillisSinceMidnight(long millis) Normalize elapsed milliseconds to the standard range from midnight to midnight.- Parameters:
millis- milliseconds elapsed since midnight- Returns:
- the normalize milliseconds representing the same time of day
-
toMillisSinceMidnight
public static int toMillisSinceMidnight(int hourOfDay, int minuteOfHour, int secondOfMinute) Gets the time, in 24-hour format, as milliseconds since midnight.- Parameters:
hourOfDay- the hour portion of the timeminuteOfHour- the minutes portion of the timesecondOfMinute- the seconds portion of the time- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
public static int toMillisSinceMidnight(long instant) Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.- Parameters:
instant- the instant in time to convert- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
Gets the time of day represented by the given instant in the specified time zone as milliseconds since midnight.- Parameters:
millis- the instant in time to convertzoneId- the time zone id relative to which to interpret the instant- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
public static int toMillisSinceMidnight(long instant, int offset) Gets the time of day represented by the given instant in the specified time zone as milliseconds since midnight.- Parameters:
instant- the instant in time to convertoffset- the time zone offset with which to interpret the instant- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.- Parameters:
time- the instant in time to convert- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.- Parameters:
time- the instant in time to convert- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
Gets the time of day represented by the given instant in the default time zone as milliseconds since midnight.- Parameters:
time- the instant in time to convert- Returns:
- the number of milliseconds elapsed since midnight
-
toMillisSinceMidnight
Gets the time of day represented by the given instant in the specified time zone as milliseconds since midnight.- Parameters:
time- the instant in time to convertzoneId- the time zone id relative to which to interpret the instant- Returns:
- the number of milliseconds elapsed since midnight
-
toTime
Gets the instant in time on January 1, 1970 in the default time zone corresponding to the given time of day.- Parameters:
dayMillis- the number of milliseconds elapsed since midnight- Returns:
- a
LocalTimeobject representing the time of day
-
localTimeToSeconds
Gets the instant in time on January 1, 1970 in the default time zone corresponding to the given time of day.- Parameters:
localTime- the localTime- Returns:
- millis since epoch
-
parseToMillisSinceMidnight
Parses a time of day in ISO8601 time format into milliseconds since midnight.- Parameters:
text- a time of day in ISO8601 format- Returns:
- the number of milliseconds elapsed since midnight
-
parseInto
Parses a time of day in ISO8601 time format, storing the result into a time valued container. The empty string is parsed as a null value.- Parameters:
text- a time of day in ISO8601 format.buffer- the container in which to store the parsed value
-
formatMillisSinceMidnight
Converts a time of day, expressed as milliseconds, into an ISO8601 time formatted string.- Parameters:
dayMillis- the number of milliseconds elapsed since midnight- Returns:
- the time of day in ISO8601 format
-
format
Converts a time of day value into an ISO8601 time formatted string.- Parameters:
value- the time value to format- Returns:
- the time of day in ISO8601 format. If the input is null valued, the empty string is returned.
-
toEpochTime
Stores the given instant into a time stamp buffer using the default time zone for the offset.- Parameters:
millis- the instant in time to convertbuffer- the container into which to store the value
-
toEpochTime
Stores the given instant into a time stamp buffer using the specified time zone for the offset.- Parameters:
millis- the instant in time to convertzoneId- the time zone Id relative to which to interpret the instantbuffer- the container into which to store the value
-
toEpochTime
Stores the given instant into a time stamp buffer using the default time zone for the offset. Nanosecond precision in the source value will be preserved, if present.- Parameters:
date- the instant in time to convertbuffer- the container into which to store the value
-
toEpochTime
Stores the given instant into a time stamp buffer using the specified time zone for the offset. Nanosecond precision in the source value will be preserved, if present.- Parameters:
date- the instant in time to convertzoneId- the time zone Id relative to which to interpret the instantbuffer- the container into which to store the value
-
toEpochTime
Stores the given instant into a time stamp buffer using the default time zone for the offset. The nanosecond precision of the source value is preserved.- Parameters:
timestamp- the instant in time to convertbuffer- the container into which to store the value
-
toEpochTime
Stores the given instant into a time stamp buffer using the specified time zone for the offset. The nanosecond precision of the source value is preserved.- Parameters:
timestamp- the instant in time to convertzoneId- the time zone id relative to which to interpret the instantbuffer- the container into which to store the value
-
toTimestamp
Gets the instant in time on corresponding to the specified epoch time.- Parameters:
epochSecs- number of seconds since Java epochsubsecNanos- fractional portion of epoch time in nanosecondsoffsetSecs- time zone + daylight saving time offset in seconds- Returns:
- a
Timestampobject representing the time stamp
-
parseInto
Parses a timestamp in ISO8601 format, storing the result into a timestamp valued container. The empty string is parsed as a null value.- Parameters:
text- a timestamp in ISO8601 format.buffer- the container in which to store the parsed value
-
formatEpochTime
Converts a time stamp, expressed as component values, into an ISO8601 time stamp formatted string.- Parameters:
seconds- number of seconds since Java epochnanos- fractional portion of epoch time in nanosecondsoffsetSeconds- time zone and daylight saving time offset, in seconds- Returns:
- the time stamp in ISO8601 format
-
format
Converts a time stamp value into an ISO8601 time stamp formatted string.- Parameters:
value- the time stamp value to format- Returns:
- the time stamp in ISO8601 format. If the input is null valued, the empty string is returned.
-
getDefaultTimeZone
-
withCSTTimeZone
-