@Immutable public final class PDTHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
birthdayCompare(LocalDate aDate1,
LocalDate aDate2)
Compare two dates by birthday.
|
static boolean |
birthdayEquals(LocalDate aDate1,
LocalDate aDate2)
Check if the two birthdays are equal.
|
static DayOfWeek |
getAsDayOfWeek(int nCalendarDayOfWeek)
Convert from Calendar day of week to
DayOfWeek enum. |
static Month |
getAsMonth(int nMonth)
Get
Month from int value in a non-throwing version. |
static int |
getCalendarDayOfWeek(DayOfWeek eDOW)
Convert from
DayOfWeek to Calendar day of week. |
static LocalDate |
getCurrentOrNextWeekday() |
static LocalDate |
getCurrentOrNextWeekday(LocalDate aStart)
Get the next week day based on the provided date.
|
static LocalDate |
getCurrentOrNextWeekendkDay()
Get the next weekend day based on the provided date.
|
static LocalDate |
getCurrentOrNextWeekendkDay(LocalDate aStart)
Get the next weekend day based on the provided date.
|
static long |
getDaysBetween(Temporal aStartIncl,
Temporal aEndExcl) |
static int |
getEndWeekOfMonth(LocalDate aDT,
Locale aLocale) |
static int |
getEndWeekOfMonth(LocalDateTime aDT,
Locale aLocale)
Get the end-week number for the passed year and month.
|
static int |
getEndWeekOfMonth(ZonedDateTime aDT,
Locale aLocale) |
static LocalDate |
getMax(LocalDate aDate1,
LocalDate aDate2) |
static LocalDateTime |
getMax(LocalDateTime aDateTime1,
LocalDateTime aDateTime2) |
static LocalTime |
getMax(LocalTime aTime1,
LocalTime aTime2) |
static OffsetDateTime |
getMax(OffsetDateTime aDateTime1,
OffsetDateTime aDateTime2) |
static ZonedDateTime |
getMax(ZonedDateTime aDateTime1,
ZonedDateTime aDateTime2) |
static LocalDate |
getMin(LocalDate aDate1,
LocalDate aDate2) |
static LocalDateTime |
getMin(LocalDateTime aDateTime1,
LocalDateTime aDateTime2) |
static LocalTime |
getMin(LocalTime aTime1,
LocalTime aTime2) |
static OffsetDateTime |
getMin(OffsetDateTime aDateTime1,
OffsetDateTime aDateTime2) |
static ZonedDateTime |
getMin(ZonedDateTime aDateTime1,
ZonedDateTime aDateTime2) |
static int |
getStartWeekOfMonth(LocalDate aDT,
Locale aLocale) |
static int |
getStartWeekOfMonth(LocalDateTime aDT,
Locale aLocale)
Get the start--week number for the passed year and month.
|
static int |
getStartWeekOfMonth(ZonedDateTime aDT,
Locale aLocale) |
static int |
getWeekDays(LocalDate aStartDate,
LocalDate aEndDate)
Count all non-weekend days in the range.
|
static int |
getWeekOfWeekBasedYear(TemporalAccessor aDT,
Locale aLocale) |
static boolean |
isBetweenIncl(LocalDate aDate,
LocalDate aLowerBound,
LocalDate aUpperBound) |
static boolean |
isFirstDayOfWeek(DayOfWeek nDayOfWeek) |
static boolean |
isFirstDayOfWeek(LocalDate aDT) |
static boolean |
isFirstDayOfWeek(LocalDateTime aDT) |
static boolean |
isFirstDayOfWeek(ZonedDateTime aDT) |
static boolean |
isLastDayOfWeek(DayOfWeek nDayOfWeek) |
static boolean |
isLastDayOfWeek(LocalDate aDT) |
static boolean |
isLastDayOfWeek(LocalDateTime aDT) |
static boolean |
isLastDayOfWeek(ZonedDateTime aDT) |
static boolean |
isNewYearsEve(LocalDate aDate) |
static boolean |
isNullValue(LocalDate aDate) |
static boolean |
isNullValue(LocalDateTime aDateTime) |
static boolean |
isNullValue(LocalTime aTime) |
static boolean |
isNullValue(ZonedDateTime aDateTime) |
static boolean |
isSameMonthAndDay(LocalDate x,
LocalDate y) |
static boolean |
isSameYearAndDay(LocalDate x,
LocalDate y) |
static boolean |
isSameYearAndWeek(LocalDate x,
LocalDate y,
Locale aLocale) |
static boolean |
isWeekend(LocalDate aDT) |
static boolean |
isWeekend(LocalDateTime aDT) |
static boolean |
isWeekendDay(DayOfWeek nDayOfWeek) |
static boolean |
isWorkDay(LocalDate aDate) |
public static boolean isNullValue(@Nullable LocalDateTime aDateTime)
public static boolean isNullValue(@Nullable ZonedDateTime aDateTime)
public static boolean isWeekendDay(DayOfWeek nDayOfWeek)
public static boolean isWeekend(@Nonnull LocalDateTime aDT)
public static boolean isFirstDayOfWeek(DayOfWeek nDayOfWeek)
public static boolean isFirstDayOfWeek(@Nonnull ZonedDateTime aDT)
public static boolean isFirstDayOfWeek(@Nonnull LocalDateTime aDT)
public static boolean isLastDayOfWeek(DayOfWeek nDayOfWeek)
public static boolean isLastDayOfWeek(@Nonnull ZonedDateTime aDT)
public static boolean isLastDayOfWeek(@Nonnull LocalDateTime aDT)
public static int getWeekDays(@Nonnull LocalDate aStartDate, @Nonnull LocalDate aEndDate)
aStartDate - start dateaEndDate - end datepublic static boolean isSameYearAndWeek(@Nonnull LocalDate x, @Nonnull LocalDate y, @Nonnull Locale aLocale)
public static boolean isSameMonthAndDay(@Nonnull LocalDate x, @Nonnull LocalDate y)
public static boolean isBetweenIncl(@Nullable LocalDate aDate, @Nullable LocalDate aLowerBound, @Nullable LocalDate aUpperBound)
public static int getWeekOfWeekBasedYear(@Nonnull TemporalAccessor aDT, @Nonnull Locale aLocale)
public static int getStartWeekOfMonth(@Nonnull LocalDateTime aDT, @Nonnull Locale aLocale)
aDT - The object to use year and month from.aLocale - Locale to use. May not be null.public static int getStartWeekOfMonth(@Nonnull LocalDate aDT, @Nonnull Locale aLocale)
public static int getStartWeekOfMonth(@Nonnull ZonedDateTime aDT, @Nonnull Locale aLocale)
public static int getEndWeekOfMonth(@Nonnull LocalDateTime aDT, @Nonnull Locale aLocale)
aDT - The object to use year and month from.aLocale - Locale to use. May not be null.public static int getEndWeekOfMonth(@Nonnull LocalDate aDT, @Nonnull Locale aLocale)
public static int getEndWeekOfMonth(@Nonnull ZonedDateTime aDT, @Nonnull Locale aLocale)
@Nonnull public static LocalDate getCurrentOrNextWeekday(@Nonnull LocalDate aStart)
aStart - The date to start at. May not be null.null.@Nonnull public static LocalDate getCurrentOrNextWeekendkDay(@Nonnull LocalDate aStart)
aStart - The date to start at. May not be null.@Nonnull public static LocalDate getCurrentOrNextWeekendkDay()
public static int birthdayCompare(@Nullable LocalDate aDate1, @Nullable LocalDate aDate2)
aDate1 - First date. May be null.aDate2 - Second date. May be null.Comparator.compare(Object, Object)public static boolean birthdayEquals(@Nullable LocalDate aDate1, @Nullable LocalDate aDate2)
aDate1 - First date. May be null.aDate2 - Second date. May be null.true if month and day are equal@Nonnull public static LocalDate getMax(@Nonnull LocalDate aDate1, @Nonnull LocalDate aDate2)
@Nonnull public static LocalTime getMax(@Nonnull LocalTime aTime1, @Nonnull LocalTime aTime2)
@Nonnull public static LocalDateTime getMax(@Nonnull LocalDateTime aDateTime1, @Nonnull LocalDateTime aDateTime2)
@Nonnull public static ZonedDateTime getMax(@Nonnull ZonedDateTime aDateTime1, @Nonnull ZonedDateTime aDateTime2)
@Nonnull public static OffsetDateTime getMax(@Nonnull OffsetDateTime aDateTime1, @Nonnull OffsetDateTime aDateTime2)
@Nonnull public static LocalDate getMin(@Nonnull LocalDate aDate1, @Nonnull LocalDate aDate2)
@Nonnull public static LocalTime getMin(@Nonnull LocalTime aTime1, @Nonnull LocalTime aTime2)
@Nonnull public static LocalDateTime getMin(@Nonnull LocalDateTime aDateTime1, @Nonnull LocalDateTime aDateTime2)
@Nonnull public static ZonedDateTime getMin(@Nonnull ZonedDateTime aDateTime1, @Nonnull ZonedDateTime aDateTime2)
@Nonnull public static OffsetDateTime getMin(@Nonnull OffsetDateTime aDateTime1, @Nonnull OffsetDateTime aDateTime2)
public static long getDaysBetween(@Nonnull Temporal aStartIncl, @Nonnull Temporal aEndExcl)
@Nonnull public static DayOfWeek getAsDayOfWeek(int nCalendarDayOfWeek)
DayOfWeek enum.nCalendarDayOfWeek - Day of week - must be between 1 and 7.DayOfWeek and never null.public static int getCalendarDayOfWeek(@Nonnull DayOfWeek eDOW)
DayOfWeek to Calendar day of week.eDOW - Day of week. May not be null.Copyright © 2014–2022 Philip Helger. All rights reserved.