Date functions
The luego.date package contains utility functions to work with dates.
luego.date
atTime
Combines a date with hour, minutes and seconds to create a datetime
dateNow
Obtains the current date from the system clock in the default time-zone. Be aware that logic that depends on the system environment is not testable so consider instead receiving the current date as an input parameter.
dateTimeNow
Obtains the current date-time from the system clock in the default time-zone. Be aware that logic that depends on the system environment is not testable so consider instead receiving the current date/time as an input parameter.
daysBetween
Returns the number of days between a start date and an end date. The result is positive when the start date is before the end date.
dtFormat
Return a formatted string for the data time
HHmm
Return a string concatenating the hours and the minutes of a datetime separated by a colon
HHmmss
Return a string concatenating hours, minutes and seconds of a datetime separated by colons
hour
Return the hour of a datetime
hoursBetween
Returns the number of hours between a start datetime and an end datetime. The result is positive when the start datetime is before the end datetime.
isAfter
Determines if the 1st date is after the 2nd date (strictly after)
isAfterOrEqual
Determines if the 1st date is after or equal to the 2nd date
isBefore
Determines if the date d1 is before the date d2 (stricly before)
isBeforeOrEqual
Determines if the date d1 is before or equal to the date d2
minusDays
Returns a copy of the date with the specified number of days subtracted
minusMonths
Returns a copy of the date with the specified number of months subtracted
minusWeeks
Returns a copy of the date with the specified number of weeks subtracted
minusYears
Returns a copy of the date with the specified number of years subtracted
minute
Return the minute of a datetime
minutesBetween
Returns the number of minutes between a start datetime and an end datetime. The result is positive when the start datetime is before the end datetime.
monthsBetween
Returns the number of months between a start date and an end date. The result is positive when the start date is before the end date.
plusDays
Returns a copy of the date d with the specified number of days n added
plusHours
Returns a copy of the datetime dt with the specified number of hours n added
plusMinutes
Returns a copy of the datetime dt with the specified number of minutes n added
plusMonths
Returns a copy of the date d with the specified number of months n added
plusWeeks
Returns a copy of the date with the specified number of weeks added
plusYears
Returns a copy of the date d with the specified number of years n added
second
Return the second of a datetime
secondsBetween
Returns the number of seconds between a start datetime and an end datetime. The result is positive when the start datetime is before the end datetime.
toDate
Extract a date from a datetime
weeksBetween
Returns the number of weeks between a start date and an end date. The result is positive when the start date is before the end date.
yearsBetween
Returns the number of years between a start date and an end date. The result is positive when the start date is before the end date.