public final class TimeUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static LocalDateTime |
calculateNextFireDateTime(LocalDateTime start,
LocalDateTime end,
LocalTime dailyStart,
LocalTime dailyEnd,
LocalDateTime from)
Calculate the date and time of next fire.
|
static boolean |
isBetween(LocalDateTime start,
LocalDateTime end,
LocalDateTime dateTime)
Check whether specific LocalDateTime is in the period formed by two given LocalDateTime.
|
static boolean |
isBetween(LocalTime start,
LocalTime end,
LocalTime time)
Check whether specific LocalTime is in the period formed by two given LocalTime.
|
static String |
nowStr(String format)
Format
LocalDteTime.now() as a string. |
static String |
toStr(LocalDate date,
String format)
Format given LocalDate as a string.
|
static String |
toStr(LocalDateTime dateTime,
String format)
Format given LocalDateTime as a string.
|
static String |
toStr(LocalTime time,
String format)
Format given LocalTime as a string.
|
static String |
toStr(ZonedDateTime zonedDateTime,
String format)
Format given ZonedDateTime as a string.
|
static String |
utcNowStr(String format)
Format
LocalDateTime.now(ZoneOffset.UTC) as a string. |
public static String nowStr(String format)
LocalDteTime.now() as a string.format - the format to be used in formatingpublic static String utcNowStr(String format)
LocalDateTime.now(ZoneOffset.UTC) as a string.format - the format to be used in formatingpublic static String toStr(LocalDateTime dateTime, String format)
dateTime - the LocalDateTime to be formattedformat - the format to be used in formatingpublic static String toStr(ZonedDateTime zonedDateTime, String format)
zonedDateTime - the ZonedDateTime to be formattedformat - the format to be used in formatingpublic static String toStr(LocalDate date, String format)
date - the LocalDate to be formattedformat - the format to be used in formatingpublic static String toStr(LocalTime time, String format)
time - the LocalTime to be formattedformat - the format to be used in formatingpublic static boolean isBetween(LocalDateTime start, LocalDateTime end, LocalDateTime dateTime)
start - the start of periodend - the end of perioddateTime - the LocalDateTime to checkdateTime is between the period, otherwise falsepublic static boolean isBetween(LocalTime start, LocalTime end, LocalTime time)
start - the start of periodend - the end of periodtime - the LocalTime to checktime is between the period, otherwise falsepublic static LocalDateTime calculateNextFireDateTime(LocalDateTime start, LocalDateTime end, LocalTime dailyStart, LocalTime dailyEnd, LocalDateTime from)
start - the start LocalDateTime of fireable periodend - the end LocalDateTime of fireable perioddailyStart - the start LocalTime of daily fireable perioddailyEnd - the end LocalTime of daily fireable periodfrom - the LocalDateTime to calculate fromLocalDateTime of next fireCopyright © 2019. All rights reserved.