-
public class DateTimes
-
-
Field Summary
-
Method Summary
Modifier and Type Method Description final ZoneIdzoneIdOrDefault(String name)final Stringformat(Long time)final Stringformat(Instant time)final Stringformat(Instant time, String format)final Stringformat(LocalDateTime localTime)final Stringformat(LocalDateTime localTime, String format)final Stringformat(OffsetDateTime localTime, String format)final Stringformat(Long epochMilli, String format)final StringformatNow(String format)final StringreadableDuration(Duration duration, ChronoUnit truncatedToUnit)final StringreadableDuration(Duration duration)final StringreadableDuration(String duration)final StringisoInstantFormat(Long time)final StringisoInstantFormat(Date date)final static StringisoInstantFormat(Instant time)final Stringnow(String format)final static Stringnow()final LocalDatetoLocalDate(Instant instant)final LocalDateTimetoLocalDateTime(Instant instant)final OffsetDateTimetoOffsetDateTime(Instant instant)final InstantstartOfHour()final InstantendOfHour()final InstantstartOfDay()final InstantendOfDay()final InstanttimePointOfDay(Integer hour, Integer minute, Integer second)final DayOfWeekdayOfWeek()final DayOfWeekdayOfWeek(Instant instant)final IntegerdayOfMonth()final IntegerdayOfMonth(Instant instant)final DurationelapsedTime()final DurationelapsedTime(Long start)final DurationelapsedTime(Instant start, Instant end)Calculate the elapsed time between two times specified in milliseconds. final DurationelapsedTime(Instant start)Calculate the elapsed time between two times specified in milliseconds. final LongelapsedSeconds()The imprecise elapsed time in seconds, at least 1 second final static InstantparseHttpDateTime(String text, Instant defaultValue)RFC 2616 defines three different date formats that a conforming client must understand. final StringformatHttpDateTime(Long time)final static StringformatHttpDateTime(Instant time)final static InstantparseInstant(String text, Instant defaultValue)final static InstantparseInstant(String text)final static InstantparseBestInstant(String text, Instant defaultValue)Accept the following format: yyyy-MM-dd[ HH[:mm:ss]]
ISO_INSTANT, or yyyy-MM-ddTHH:mm:ssZ
final static InstantparseBestInstant(String text)Accept the following format: yyyy-MM-dd[ HH[:mm:ss]]
ISO_INSTANT, or yyyy-MM-ddTHH:mm:ssZ
final static InstantparseBestInstantOrNull(String text)Accept the following format: yyyy-MM-dd[ HH[:mm:ss]]
ISO_INSTANT, or yyyy-MM-ddTHH:mm:ssZ
final static DurationparseDuration(String duration, Duration defaultValue)final static StringconstructTimeHistory(String timeHistory, Instant fetchTime, Integer maxRecords)final static BooleanisDaysBefore(OffsetDateTime dateTime, Integer days)final SimpleDateFormatgetPATH_SAFE_FORMAT_1()final SimpleDateFormatgetPATH_SAFE_FORMAT_2()final SimpleDateFormatgetPATH_SAFE_FORMAT_3()final SimpleDateFormatgetPATH_SAFE_FORMAT_4()final LonggetHOURS_PER_DAY()final LonggetHOURS_PER_MONTH()final LonggetHOURS_PER_YEAR()final LonggetMILLIS_PER_SECOND()final LonggetMILLIS_PER_MINUTE()final LonggetMILLIS_PER_HOUR()final LonggetMILLIS_PER_DAY()final LonggetMINUTES_PER_HOUR()final LonggetSECONDS_PER_MINUTE()final LonggetSECONDS_PER_HOUR()final LonggetSECONDS_PER_DAY()final InstantgetONE_YEAR_LATER()final StringgetDATE_REGEX()final StringgetDATE_TIME_REGEX()final StringgetSIMPLE_DATE_TIME_REGEX()final StringgetPULSAR_ZONE_ID()final ZoneIdgetZoneId()The default zone id final UnitsetZoneId(ZoneId zoneId)The default zone id final ZoneOffsetgetZoneOffset()final InstantgetStartTime()The time to start the program final InstantgetDoomsday()We foresee that 2200 will be the end of the world, care about nothing after the doom final LocalDateTimegetMidnight()final LocalDateTimegetStartOfHour()final DurationgetElapsed()final DurationgetElapsedToday()final DurationgetElapsedThisHour()-
-
Method Detail
-
zoneIdOrDefault
final ZoneId zoneIdOrDefault(String name)
-
format
final String format(LocalDateTime localTime)
-
format
final String format(LocalDateTime localTime, String format)
-
format
final String format(OffsetDateTime localTime, String format)
-
readableDuration
@JvmOverloads() final String readableDuration(Duration duration, ChronoUnit truncatedToUnit)
-
readableDuration
@JvmOverloads() final String readableDuration(Duration duration)
-
readableDuration
final String readableDuration(String duration)
-
isoInstantFormat
final String isoInstantFormat(Long time)
-
isoInstantFormat
final String isoInstantFormat(Date date)
-
isoInstantFormat
final static String isoInstantFormat(Instant time)
-
toLocalDate
final LocalDate toLocalDate(Instant instant)
-
toLocalDateTime
final LocalDateTime toLocalDateTime(Instant instant)
-
toOffsetDateTime
final OffsetDateTime toOffsetDateTime(Instant instant)
-
startOfHour
final Instant startOfHour()
-
startOfDay
final Instant startOfDay()
-
timePointOfDay
final Instant timePointOfDay(Integer hour, Integer minute, Integer second)
-
dayOfMonth
final Integer dayOfMonth()
-
dayOfMonth
final Integer dayOfMonth(Instant instant)
-
elapsedTime
final Duration elapsedTime()
-
elapsedTime
final Duration elapsedTime(Long start)
-
elapsedTime
@JvmOverloads() final Duration elapsedTime(Instant start, Instant end)
Calculate the elapsed time between two times specified in milliseconds.
-
elapsedTime
@JvmOverloads() final Duration elapsedTime(Instant start)
Calculate the elapsed time between two times specified in milliseconds.
-
elapsedSeconds
final Long elapsedSeconds()
The imprecise elapsed time in seconds, at least 1 second
-
parseHttpDateTime
final static Instant parseHttpDateTime(String text, Instant defaultValue)
RFC 2616 defines three different date formats that a conforming client must understand.
-
formatHttpDateTime
final String formatHttpDateTime(Long time)
-
formatHttpDateTime
final static String formatHttpDateTime(Instant time)
-
parseInstant
@JvmOverloads() final static Instant parseInstant(String text, Instant defaultValue)
-
parseInstant
@JvmOverloads() final static Instant parseInstant(String text)
-
parseBestInstant
@JvmOverloads() final static Instant parseBestInstant(String text, Instant defaultValue)
Accept the following format:
yyyy-MM-dd[ HH[:mm:ss]]
ISO_INSTANT, or yyyy-MM-ddTHH:mm:ssZ
-
parseBestInstant
@JvmOverloads() final static Instant parseBestInstant(String text)
Accept the following format:
yyyy-MM-dd[ HH[:mm:ss]]
ISO_INSTANT, or yyyy-MM-ddTHH:mm:ssZ
-
parseBestInstantOrNull
final static Instant parseBestInstantOrNull(String text)
Accept the following format:
yyyy-MM-dd[ HH[:mm:ss]]
ISO_INSTANT, or yyyy-MM-ddTHH:mm:ssZ
-
parseDuration
final static Duration parseDuration(String duration, Duration defaultValue)
-
constructTimeHistory
final static String constructTimeHistory(String timeHistory, Instant fetchTime, Integer maxRecords)
-
isDaysBefore
final static Boolean isDaysBefore(OffsetDateTime dateTime, Integer days)
-
getPATH_SAFE_FORMAT_1
final SimpleDateFormat getPATH_SAFE_FORMAT_1()
-
getPATH_SAFE_FORMAT_2
final SimpleDateFormat getPATH_SAFE_FORMAT_2()
-
getPATH_SAFE_FORMAT_3
final SimpleDateFormat getPATH_SAFE_FORMAT_3()
-
getPATH_SAFE_FORMAT_4
final SimpleDateFormat getPATH_SAFE_FORMAT_4()
-
getHOURS_PER_DAY
final Long getHOURS_PER_DAY()
-
getHOURS_PER_MONTH
final Long getHOURS_PER_MONTH()
-
getHOURS_PER_YEAR
final Long getHOURS_PER_YEAR()
-
getMILLIS_PER_SECOND
final Long getMILLIS_PER_SECOND()
-
getMILLIS_PER_MINUTE
final Long getMILLIS_PER_MINUTE()
-
getMILLIS_PER_HOUR
final Long getMILLIS_PER_HOUR()
-
getMILLIS_PER_DAY
final Long getMILLIS_PER_DAY()
-
getMINUTES_PER_HOUR
final Long getMINUTES_PER_HOUR()
-
getSECONDS_PER_MINUTE
final Long getSECONDS_PER_MINUTE()
-
getSECONDS_PER_HOUR
final Long getSECONDS_PER_HOUR()
-
getSECONDS_PER_DAY
final Long getSECONDS_PER_DAY()
-
getONE_YEAR_LATER
final Instant getONE_YEAR_LATER()
-
getDATE_REGEX
final String getDATE_REGEX()
-
getDATE_TIME_REGEX
final String getDATE_TIME_REGEX()
-
getSIMPLE_DATE_TIME_REGEX
final String getSIMPLE_DATE_TIME_REGEX()
-
getPULSAR_ZONE_ID
final String getPULSAR_ZONE_ID()
-
getZoneOffset
final ZoneOffset getZoneOffset()
-
getStartTime
final Instant getStartTime()
The time to start the program
-
getDoomsday
final Instant getDoomsday()
We foresee that 2200 will be the end of the world, care about nothing after the doom
-
getMidnight
final LocalDateTime getMidnight()
-
getStartOfHour
final LocalDateTime getStartOfHour()
-
getElapsed
final Duration getElapsed()
-
getElapsedToday
final Duration getElapsedToday()
-
getElapsedThisHour
final Duration getElapsedThisHour()
-
-
-