public class TimeUtil
extends java.lang.Object
withDefaults or as a
self parametrized class.| Modifier and Type | Field and Description |
|---|---|
static TimeUtil |
withDefaults |
| Constructor and Description |
|---|
TimeUtil(java.time.ZoneId zoneId,
java.util.Locale locale,
java.lang.String dtfPattern) |
| Modifier and Type | Method and Description |
|---|---|
java.time.format.DateTimeFormatter |
getDateTimeFormatter() |
java.lang.String |
getDtfPattern() |
java.util.Locale |
getLocale() |
int |
getQuarterHourOfDay(java.time.ZonedDateTime time)
Determines the number of quarter hour of the day (starting with 0).
|
java.util.TimeZone |
getTimeZone() |
java.time.ZoneId |
getZoneId() |
static java.time.ZonedDateTime |
toNextFull(java.time.ZonedDateTime zdt,
java.time.temporal.ChronoUnit chronoUnit)
Moves the given zoned date time to the next full unit (e.g.
|
java.lang.String |
toString(java.time.Instant instant)
Converts a given instant to a time string
|
java.lang.String |
toString(java.time.ZonedDateTime zonedDateTime)
Converts a given ZoneDateTime to a time string
|
java.time.ZonedDateTime |
toZonedDateTime(java.lang.String timeString)
Returns an ZoneDateTime based on a given String, which can be understood by the class private
DateTimeFormatter
|
long |
zonedDateTimeDifference(java.time.ZonedDateTime startDateTime,
java.time.ZonedDateTime endDateTime,
java.time.temporal.ChronoUnit unit)
Calculate the difference between two [[ZonedDateTime]]s and return the difference in the given
[[ChronoUnit]]
|
long |
zonedDateTimeDifferenceInSeconds(java.time.ZonedDateTime startDateTime,
java.time.ZonedDateTime endDateTime)
Calculate the difference between two given [[ZonedDateTime]]s and return the difference in
seconds
|
public static final TimeUtil withDefaults
public TimeUtil(java.time.ZoneId zoneId,
java.util.Locale locale,
java.lang.String dtfPattern)
public java.lang.String toString(java.time.Instant instant)
instant - Instant to be converted to Stringpublic java.lang.String toString(java.time.ZonedDateTime zonedDateTime)
zonedDateTime - Instant to be converted to Stringpublic java.time.ZonedDateTime toZonedDateTime(java.lang.String timeString)
timeString - String to convert to Instantpublic java.time.ZoneId getZoneId()
public java.util.TimeZone getTimeZone()
public java.util.Locale getLocale()
public java.lang.String getDtfPattern()
public java.time.format.DateTimeFormatter getDateTimeFormatter()
public int getQuarterHourOfDay(java.time.ZonedDateTime time)
time - Time, from which the number of quarter hour may be determinedpublic long zonedDateTimeDifferenceInSeconds(java.time.ZonedDateTime startDateTime,
java.time.ZonedDateTime endDateTime)
startDateTime - the start date timeendDateTime - the end date timepublic long zonedDateTimeDifference(java.time.ZonedDateTime startDateTime,
java.time.ZonedDateTime endDateTime,
java.time.temporal.ChronoUnit unit)
startDateTime - the start date timeendDateTime - the end date timeunit - the chrono unit that should be used returnedpublic static java.time.ZonedDateTime toNextFull(java.time.ZonedDateTime zdt,
java.time.temporal.ChronoUnit chronoUnit)
zdt - Zoned date time to alterchronoUnit - Next full time unit