public final class LocalDateTimeHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static LocalDateTime |
END_DATE_NA
Date representing NA at the end of a date range: Friday December 31 23:59:00 2049.
|
static LocalDateTime |
START_DATE_NA
Date representing NA at the start of a date range: January 01 00:00:00 1984.
|
| Constructor and Description |
|---|
LocalDateTimeHelper() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(LocalDateTime d1,
LocalDateTime d2)
Compare two dates, handling null values.
|
static int |
compare(LocalDateTime startDate,
LocalDateTime endDate,
LocalDateTime targetDate)
This method compares a target date with a date range.
|
static LocalDateTime |
getDayStartDate(LocalDateTime date)
Returns a new Date instance whose value
represents the start of the day (i.e.
|
static Duration |
getVariance(ProjectCalendar calendar,
LocalDateTime date1,
LocalDateTime date2,
TimeUnit format)
This utility method calculates the difference in working
time between two dates, given the context of a calendar.
|
static LocalDateTime |
max(LocalDateTime d1,
LocalDateTime d2)
Returns the later of two dates, handling null values.
|
static LocalDateTime |
min(LocalDateTime d1,
LocalDateTime d2)
Returns the earlier of two dates, handling null values.
|
static LocalDateTime |
parseBest(DateTimeFormatter format,
String value)
Use the parseBest method of the formatter to retrieve a LocalDateTime instance
handling the case where the formatter returns a LocalDate instance.
|
public static final LocalDateTime START_DATE_NA
public static final LocalDateTime END_DATE_NA
public static LocalDateTime getDayStartDate(LocalDateTime date)
date - date to convertpublic static int compare(LocalDateTime startDate, LocalDateTime endDate, LocalDateTime targetDate)
startDate - range start dateendDate - range end datetargetDate - target date in millisecondspublic static int compare(LocalDateTime d1, LocalDateTime d2)
d1 - Date instanced2 - Date instancepublic static LocalDateTime min(LocalDateTime d1, LocalDateTime d2)
d1 - Date instanced2 - Date instancepublic static LocalDateTime max(LocalDateTime d1, LocalDateTime d2)
d1 - Date instanced2 - Date instancepublic static LocalDateTime parseBest(DateTimeFormatter format, String value)
format - DateTimeFormatter instancevalue - value to parsepublic static Duration getVariance(ProjectCalendar calendar, LocalDateTime date1, LocalDateTime date2, TimeUnit format)
calendar - calendardate1 - first datedate2 - second dateformat - required format for the resulting durationCopyright © 2000–2025 MPXJ. All rights reserved.