Class DatesKt
-
- All Implemented Interfaces:
public final class DatesKt
-
-
Field Summary
Fields Modifier and Type Field Description private final static ZoneIdGMT_ZONE
-
Method Summary
Modifier and Type Method Description final ZoneIdgetGMT_ZONE()GMT zone ID. final static LongtoNumber(LocalDateTime $self)Convert a date time to a number with the following format: YYYYMMDDHHmmss.final static IntegertoNumber(LocalDate $self)Convert a date to an integer with the following format: YYYYMMDD.final static IntegertoNumber(LocalTime $self)Convert a time to an integer with the following format: HHmmssSSS.final static ZonedDateTimewithZone(LocalDateTime $self, ZoneId zoneId)Return the date time in a given time zone for a local date time. final static LocalDateTimetoLocalDateTime(Long $self)Parse a date time from a formatted number with this format: YYYYMMDDHHmmss.final static LocalDateTimetoLocalDateTime(Date $self)Convert a date to a local date time. final static LocalDatetoLocalDate(Integer $self)Parse a date from a formatted integer with this format: YYYYMMDD.final static LocalDatetoLocalDate(Date $self)Convert a date to a local date. final static LocalTimetoLocalTime(Integer $self)Parse a time from a formatted integer with this format: HHmmssSSS.final static DatetoDate(ZonedDateTime $self)Convert a zoned date time to a date. final static DatetoDate(LocalDateTime $self)Convert a local date time to a date. final static DatetoDate(LocalDate $self)Convert a local date to a date. final static DoubletoTotalDays(Period $self)Calculate the aproximate number of days comprised in a time period. final static PeriodparsePeriod(String text)Parse a time period allowing a more relaxed format: with spaces or commas, lowercase characters and not forcing the text to start with 'P'. final static DurationparseDuration(String text)Parse a time duration allowing a more relaxed format: with spaces or commas, lowercase characters and not forcing the text to start with 'P', however, the 'T' is still mandatory to separate date and time durations. final static LocalDateparseLocalDate(String text)Parse a local date allowing only to specify the year or the year and the month. -
-
Method Detail
-
getGMT_ZONE
final ZoneId getGMT_ZONE()
GMT zone ID.
-
toNumber
final static Long toNumber(LocalDateTime $self)
Convert a date time to a number with the following format:
YYYYMMDDHHmmss.- Returns:
Numeric representation of the given date.
-
toNumber
final static Integer toNumber(LocalDate $self)
Convert a date to an integer with the following format:
YYYYMMDD.- Returns:
Numeric representation of the given date.
-
toNumber
final static Integer toNumber(LocalTime $self)
Convert a time to an integer with the following format:
HHmmssSSS.- Returns:
Numeric representation of the given time.
-
withZone
final static ZonedDateTime withZone(LocalDateTime $self, ZoneId zoneId)
Return the date time in a given time zone for a local date time.
- Parameters:
zoneId- Id of the target zone of the passed local date time.- Returns:
Received date time at the given zoneId.
-
toLocalDateTime
final static LocalDateTime toLocalDateTime(Long $self)
Parse a date time from a formatted number with this format:
YYYYMMDDHHmmss.- Returns:
Local date time representation of the given number.
-
toLocalDateTime
final static LocalDateTime toLocalDateTime(Date $self)
Convert a date to a local date time.
- Returns:
Local date time representation of the given date.
-
toLocalDate
final static LocalDate toLocalDate(Integer $self)
Parse a date from a formatted integer with this format:
YYYYMMDD.- Returns:
Local date representation of the given number.
-
toLocalDate
final static LocalDate toLocalDate(Date $self)
Convert a date to a local date.
- Returns:
Local date representation of the given date.
-
toLocalTime
final static LocalTime toLocalTime(Integer $self)
Parse a time from a formatted integer with this format:
HHmmssSSS.- Returns:
Local time representation of the given number.
-
toDate
final static Date toDate(ZonedDateTime $self)
Convert a zoned date time to a date.
- Returns:
Date representation of the given zoned date time.
-
toDate
final static Date toDate(LocalDateTime $self)
Convert a local date time to a date.
- Returns:
Date representation of the given local date time.
-
toDate
final static Date toDate(LocalDate $self)
Convert a local date to a date.
- Returns:
Date representation of the given local date.
-
toTotalDays
final static Double toTotalDays(Period $self)
Calculate the aproximate number of days comprised in a time period.
- Returns:
Aproximate number of days of the period.
-
parsePeriod
final static Period parsePeriod(String text)
Parse a time period allowing a more relaxed format: with spaces or commas, lowercase characters and not forcing the text to start with 'P'.
- Parameters:
text- Text to be parsed to a time period.- Returns:
Time period parsed from the supplied text.
-
parseDuration
final static Duration parseDuration(String text)
Parse a time duration allowing a more relaxed format: with spaces or commas, lowercase characters and not forcing the text to start with 'P', however, the 'T' is still mandatory to separate date and time durations.
- Parameters:
text- Text to be parsed to a time duration.- Returns:
Time duration parsed from the supplied text.
-
parseLocalDate
final static LocalDate parseLocalDate(String text)
Parse a local date allowing only to specify the year or the year and the month. Missing month and day will be defaulted to january and one respectively.
- Parameters:
text- Text to be parsed to a local date.- Returns:
Local date parsed from the supplied text.
-
-
-
-