public final class DateAndTime extends Object
| Constructor and Description |
|---|
DateAndTime() |
| Modifier and Type | Method and Description |
|---|---|
static java.time.LocalDate |
CurrentDate() |
static java.time.LocalDateTime |
CurrentDateTime() |
static java.time.LocalTime |
CurrentTime() |
static long |
CurrentTimeMS() |
static java.time.ZonedDateTime |
CurrentTimestamp() |
static long |
CurrentTimestampMS() |
static long |
CurrentTimestampNano() |
static java.time.LocalDate |
DateFromComponents(Integer year,
Integer month,
Integer day)
Creates a
LocalDate from the components year, month, and day. |
static java.time.LocalDate |
DateFromDaysSince(Integer days)
Returns a date object by adding an integer to a current date.
|
static java.time.LocalDate |
DateFromDaysSince(Integer days,
java.time.LocalDate baseline)
Returns a date object by adding an integer to a baseline date.
|
static java.time.LocalDate |
DateFromJulianDay(Long julianDay)
Returns a date from the given Julian day number.
|
static java.time.LocalDate |
DateOffsetByComponents(java.time.LocalDate baseline,
Integer yearOffset,
Integer monthOffset,
Integer daysOffset)
Returns the given date, with offsets applied from the given year offset, month offset, and day of month offset.
|
static java.time.LocalDate |
DateOffsetByDays(java.time.LocalDate date,
Integer daysOffset)
Returns the given date offset by the given number of days.
|
static java.time.LocalDateTime |
DateTimeFromEpoch(Long epochTimestamp)
Returns a datetime from the given epoch time specified in seconds.
|
static java.time.LocalDateTime |
DateTimeFromSecondsSince(Integer seconds,
java.time.LocalDateTime time)
Returns a datetime that is derived from the number of seconds from the base datetime object.
|
static java.time.LocalDateTime |
DateTimeFromTime(java.time.LocalTime time,
java.time.LocalDateTime datetime)
Returns a datetime from the given time and datetime objects.
|
static java.time.LocalDateTime |
DateTimeOffsetByComponents(java.time.LocalDateTime datetime,
Integer yearOffset,
Integer monthOffset,
Integer dayOfMonthOffset,
Integer hourOffset,
Integer minOffset,
Integer secondOffset)
Returns a datetime from the given time and the offsets.
|
static java.time.LocalDateTime |
DateTimeOffsetBySeconds(java.time.LocalDateTime datetime,
Integer secondsOffset) |
static Integer |
DaysInMonth(java.time.LocalDate date)
Returns the number of days in the month in the given base date.
|
static Integer |
DaysInYear(java.time.LocalDate date)
Returns the number of days in the year in the given base date.
|
static Long |
DaysSinceFromDate(java.time.LocalDate source,
java.time.LocalDate destination)
Returns the number of days from the source date to the given date.
|
static Long |
EpochFromDateTime(java.time.LocalDateTime datetime) |
static Long |
EpochFromTimestamp(java.time.ZonedDateTime timestamp) |
static long |
EpochSeconds() |
static java.time.LocalDate |
GetDate(String date)
Return the
LocalDate the string represents. |
static java.time.LocalDateTime |
GetDateTime(java.time.LocalDate date,
java.time.LocalTime time)
Returns a datetime from the given date and time.
|
static java.time.LocalDateTime |
GetDateTime(String date)
Return the
LocalDateTime the string represents. |
static java.time.LocalTime |
GetTime(String time)
Return the
LocalTime the string represents. |
static Integer |
HoursFromTime(java.time.LocalTime time)
Returns the hours portion of a time.
|
static Long |
JulianDayFromDate(java.time.LocalDate date)
Returns a Julian day number from the given date.
|
static Integer |
MicroSecondsFromTime(java.time.LocalTime time)
Returns the microsecond portion of a time.
|
static Integer |
MidnightSecondsFromTime(java.time.LocalTime time)
Returns the number of seconds from midnight to the given time.
|
static Integer |
MilliSecondsFromTime(java.time.LocalTime time)
Returns the millisecond portion of a time.
|
static Integer |
MinutesFromTime(java.time.LocalTime time)
Returns the minutes portion of a time.
|
static Integer |
MonthDayFromDate(java.time.LocalDate date)
Returns the day of the month from the given date.
|
static Integer |
MonthFromDate(java.time.LocalDate date)
Returns the month number from the given date.
|
static Integer |
NanoSecondsFromTime(java.time.LocalTime time)
Returns the Nanosecond portion of a time.
|
static java.time.LocalDate |
NextWeekdayFromDate(java.time.LocalDate source,
String textDayOfWeek)
Returns the date of the specified day of the week soonest after the source date.
|
static java.time.LocalDate |
NthWeekdayFromDate(java.time.LocalDate source,
String textDayOfWeek,
Number offset)
Returns the date of the specified day of the week offset by the specified number of weeks from the source date.
|
static java.time.LocalDate |
PreviousWeekdayFromDate(java.time.LocalDate source,
String textDayOfWeek)
Returns the date of the specified day of the week that is the most recent day before the source date.
|
static Integer |
SecondsFromTime(java.time.LocalTime time)
Returns the seconds portion of a time.
|
static Long |
SecondsSinceFromDateTime(java.time.LocalDateTime source,
java.time.LocalDateTime destination)
Returns the number of seconds between two datetime objects.
|
static String |
TimeDate() |
static java.time.LocalTime |
TimeFromComponents(Integer hours,
Integer mins,
Integer seconds,
Integer microseconds)
Returns a time from the given hours, minutes, seconds, and microseconds, given as four separate values.
|
static java.time.LocalTime |
TimeFromMidnightSeconds(Integer seconds)
Returns the time given the number of seconds since midnight.
|
static java.time.LocalTime |
TimeOffsetByComponents(java.time.LocalTime time,
Integer hour,
Integer min,
Integer seconds)
Returns the time, with offsets applied from the base time.
|
static Integer |
WeekdayFromDate(java.time.LocalDate date) |
static Integer |
WeekdayFromDate(java.time.LocalDate date,
String startOfWeek) |
static Integer |
YeardayFromDate(java.time.LocalDate date) |
static Integer |
YearFromDate(java.time.LocalDate date) |
static Integer |
YearweekFromDate(java.time.LocalDate date) |
public static java.time.LocalDate GetDate(String date)
LocalDate the string represents. If the string is null, this method will return null.public static java.time.LocalTime GetTime(String time)
LocalTime the string represents. If the string is null, this method will return null.public static java.time.LocalDateTime GetDateTime(String date)
LocalDateTime the string represents. If the string is null, this method will return null.public static java.time.LocalDate CurrentDate()
public static java.time.LocalTime CurrentTime()
public static long CurrentTimeMS()
public static java.time.LocalDateTime CurrentDateTime()
public static java.time.ZonedDateTime CurrentTimestamp()
public static long EpochSeconds()
public static long CurrentTimestampMS()
public static long CurrentTimestampNano()
public static java.time.LocalDate DateFromDaysSince(Integer days)
days - to be added to current date.LocalDate by adding days to current date.public static java.time.LocalDate DateFromDaysSince(Integer days, java.time.LocalDate baseline)
days - to be added to the baseline date.baseline - date to which 'days' are added.public static java.time.LocalDate DateFromComponents(Integer year, Integer month, Integer day)
LocalDate from the components year, month, and day. If any input is null, null will be
returned.year - to used for date.month - to be used for date.day - to be used for dateLocalDatepublic static java.time.LocalDate DateFromJulianDay(Long julianDay)
julianDay - Julian day numberLocalDate that represents the Julian day.public static java.time.LocalDate DateOffsetByComponents(java.time.LocalDate baseline,
Integer yearOffset,
Integer monthOffset,
Integer daysOffset)
baseline - baseline date.yearOffset - year offset to be applied.monthOffset - month offset to be applied.daysOffset - days offset to be applied.public static Long DaysSinceFromDate(java.time.LocalDate source, java.time.LocalDate destination)
source - date of LocalDate type.destination - date of LocalDate type.public static Integer DaysInMonth(java.time.LocalDate date)
date - date of LocalDate type.public static Integer DaysInYear(java.time.LocalDate date)
date - date of LocalDate type.public static java.time.LocalDate DateOffsetByDays(java.time.LocalDate date,
Integer daysOffset)
date - date of LocalDate type.daysOffset - days to offset the baseline date.public static Integer HoursFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Long JulianDayFromDate(java.time.LocalDate date)
date - of LocalDate type.public static Integer NanoSecondsFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Integer MicroSecondsFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Integer MilliSecondsFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Integer MidnightSecondsFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Integer MinutesFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Integer MonthDayFromDate(java.time.LocalDate date)
date - of LocalDate type.public static Integer MonthFromDate(java.time.LocalDate date)
date - of LocalDate type.public static java.time.LocalDate NextWeekdayFromDate(java.time.LocalDate source,
String textDayOfWeek)
source - of LocalDate type.textDayOfWeek - text day of the week.public static java.time.LocalDate NthWeekdayFromDate(java.time.LocalDate source,
String textDayOfWeek,
Number offset)
source - of LocalDate type.textDayOfWeek - Display week of day stringoffset - offset week.public static java.time.LocalDate PreviousWeekdayFromDate(java.time.LocalDate source,
String textDayOfWeek)
source - of LocalDate type.textDayOfWeek - Display week of day stringpublic static Integer SecondsFromTime(java.time.LocalTime time)
time - of LocalTime type.public static Long SecondsSinceFromDateTime(java.time.LocalDateTime source, java.time.LocalDateTime destination)
source - a LocalDateTime typedestination - a LocalDateTime typepublic static String TimeDate()
public static java.time.LocalTime TimeFromComponents(Integer hours, Integer mins, Integer seconds, Integer microseconds)
hours - component of LocalTimemins - component of LocalTimeseconds - component of LocalTimemicroseconds - component of LocalTimeLocalTimepublic static java.time.LocalTime TimeFromMidnightSeconds(Integer seconds)
seconds - since midnight.public static java.time.LocalTime TimeOffsetByComponents(java.time.LocalTime time,
Integer hour,
Integer min,
Integer seconds)
time - baseline LocalTimehour - offset to added to baseline.min - offset to added to baseline.seconds - offset to added to baseline.public static java.time.LocalDateTime GetDateTime(java.time.LocalDate date,
java.time.LocalTime time)
date - a instance of LocalDatetime - a instance of LocalTimeLocalDateTimepublic static java.time.LocalDateTime DateTimeFromSecondsSince(Integer seconds, java.time.LocalDateTime time)
seconds - to be added to base datetime.time - base datetime.public static java.time.LocalDateTime DateTimeFromEpoch(Long epochTimestamp)
epochTimestamp - specified in seconds.LocalDateTimepublic static java.time.LocalDateTime DateTimeFromTime(java.time.LocalTime time,
java.time.LocalDateTime datetime)
time - to replace in datetimedatetime - who's datetime has to replaced.public static java.time.LocalDateTime DateTimeOffsetByComponents(java.time.LocalDateTime datetime,
Integer yearOffset,
Integer monthOffset,
Integer dayOfMonthOffset,
Integer hourOffset,
Integer minOffset,
Integer secondOffset)
public static java.time.LocalDateTime DateTimeOffsetBySeconds(java.time.LocalDateTime datetime,
Integer secondsOffset)
public static Long EpochFromDateTime(java.time.LocalDateTime datetime)
public static Long EpochFromTimestamp(java.time.ZonedDateTime timestamp)
public static Integer WeekdayFromDate(java.time.LocalDate date, String startOfWeek)
public static Integer WeekdayFromDate(java.time.LocalDate date)
public static Integer YeardayFromDate(java.time.LocalDate date)
public static Integer YearFromDate(java.time.LocalDate date)
public static Integer YearweekFromDate(java.time.LocalDate date)
Copyright © 2022 CDAP Licensed under the Apache License, Version 2.0.