Package javapersianutils.core.datetime
Class DateTimeUtils
- java.lang.Object
-
- javapersianutils.core.datetime.DateTimeUtils
-
public class DateTimeUtils extends Object
LocalTimeUtils
The Date Time Utils Some helper methods for working with georgian calendar- Since:
- 3/23/2019
- Version:
- 1.0
- Author:
- Mahdi Razavi
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getAge(LocalDate birthday)
Calculate the age at the current time.static int
getAge(LocalDate birthday, LocalDate currentDate)
Calculate the age at the given datestatic boolean
hasOverlap(Interval t1, Interval t2)
Check t1 has overlap with t1 or notstatic boolean
isBetween(LocalDateTime givenDate, LocalDateTime startDate, LocalDateTime endDate)
Checks the given date is between the two provided datesstatic boolean
isLastDayOfTheMonth(LocalDate localDate)
Returns whether the given date is the last day of the monthstatic boolean
isWeekend(LocalDate dt)
Returns whether the given date falls in a weekend
-
-
-
Method Detail
-
getAge
public static int getAge(LocalDate birthday, LocalDate currentDate)
Calculate the age at the given date- Parameters:
birthday
- the birthdaycurrentDate
- the current date- Returns:
- age age
-
getAge
public static int getAge(LocalDate birthday)
Calculate the age at the current time.- Parameters:
birthday
- the birthday- Returns:
- age age
-
isBetween
public static boolean isBetween(LocalDateTime givenDate, LocalDateTime startDate, LocalDateTime endDate)
Checks the given date is between the two provided dates- Parameters:
givenDate
- the given datestartDate
- the start dateendDate
- the end date- Returns:
- boolean boolean
-
isLastDayOfTheMonth
public static boolean isLastDayOfTheMonth(LocalDate localDate)
Returns whether the given date is the last day of the month- Parameters:
localDate
- the local date- Returns:
- boolean boolean
-
isWeekend
public static boolean isWeekend(LocalDate dt)
Returns whether the given date falls in a weekend- Parameters:
dt
- the dt- Returns:
- boolean boolean
-
-