Object DateTimes
-
- All Implemented Interfaces:
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 BooleanisExpired(Instant start, Duration expiry)final BooleanisNotExpired(Instant start, Duration expiry)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 text, Duration defaultValue)final static DurationparseDurationOrNull(String text)final BooleanisDuration(String text)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 InstantgetONE_YEAR_LATER()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
-
isNotExpired
final Boolean isNotExpired(Instant start, Duration expiry)
-
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 text, Duration defaultValue)
-
parseDurationOrNull
final static Duration parseDurationOrNull(String text)
-
isDuration
final Boolean isDuration(String text)
-
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()
-
getONE_YEAR_LATER
final Instant getONE_YEAR_LATER()
-
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()
-
-
-