Temporal adjusters for the Timing library - functions that adjust dates/times to specific temporal points using numeric domain arithmetic.
Temporal adjusters for the Timing library - functions that adjust dates/times to specific temporal points using numeric domain arithmetic.
(add-business-days value n)
(add-business-days value n {:keys [weekend-days] :or {weekend-days #{7 6}}})
Adds n business days, skipping weekends.
Adds n business days, skipping weekends.
(add-months value n)
Adds n months to a time value, handling variable month lengths properly. Examples:
Adds n months to a time value, handling variable month lengths properly. Examples: - Jan 31 + 1 month = Feb 28 (Feb has fewer days) - Feb 29 + 12 months = Feb 28 (if target year is not a leap year) - Any date + n months maintains the same day when possible
(add-years value n)
Adds n years to a time value, handling leap years properly. Examples:
Adds n years to a time value, handling leap years properly. Examples: - Feb 29, 2024 + 1 year = Feb 28, 2025 (2025 is not a leap year) - Any other date + n years maintains the same month and day
(business-days-in-range start end)
(business-days-in-range start
end
{:keys [weekend-days] :or {weekend-days #{7 6}}})
Returns sequence of business days between start and end (inclusive).
Returns sequence of business days between start and end (inclusive).
(end-of-month value)
Adjusts value to the last day of the month just before midnight.
Adjusts value to the last day of the month just before midnight.
(end-of-quarter value)
Adjusts value to the last day of the quarter.
Adjusts value to the last day of the quarter.
(end-of-week value)
(end-of-week value {:keys [first-day-of-week] :or {first-day-of-week 1}})
Adjusts value to the end of the week (Sunday by default). Options: {:first-day-of-week 7} for Sunday start
Adjusts value to the end of the week (Sunday by default). Options: {:first-day-of-week 7} for Sunday start
(end-of-year value)
Adjusts value to December 31st just before midnight.
Adjusts value to December 31st just before midnight.
(every-nth-day-of-week start-value target-day n)
Generates a sequence of every nth occurrence of a day-of-week. Example: Every 2nd Monday starting from a date
Generates a sequence of every nth occurrence of a day-of-week. Example: Every 2nd Monday starting from a date
(first-day-of-month-on-day-of-week value target-day)
Finds the first occurrence of a day of week in the month. Example: First Monday of March 2024
Finds the first occurrence of a day of week in the month. Example: First Monday of March 2024
(last-day-of-month-on-day-of-week value target-day)
Finds the last occurrence of a day of week in the month. Example: Last Friday of March 2024
Finds the last occurrence of a day of week in the month. Example: Last Friday of March 2024
(next-business-day value)
(next-business-day value {:keys [weekend-days] :or {weekend-days #{7 6}}})
Adjusts to the next business day (Monday-Friday). Options: {:weekend-days #{6 7}} to customize weekend
Adjusts to the next business day (Monday-Friday). Options: {:weekend-days #{6 7}} to customize weekend
(next-day-of-week value target-day)
Adjusts value to the next occurrence of the specified day of week. Day: 1=Monday, 2=Tuesday, ..., 7=Sunday
Adjusts value to the next occurrence of the specified day of week. Day: 1=Monday, 2=Tuesday, ..., 7=Sunday
(next-or-same-day-of-week value target-day)
Adjusts value to the next occurrence of the specified day of week, or returns the same value if it's already that day.
Adjusts value to the next occurrence of the specified day of week, or returns the same value if it's already that day.
(nth-day-of-month-on-day-of-week value target-day n)
Finds the nth occurrence of a day of week in the month. Example: 3rd Tuesday of March 2024
Finds the nth occurrence of a day of week in the month. Example: 3rd Tuesday of March 2024
(previous-business-day value)
(previous-business-day value {:keys [weekend-days] :or {weekend-days #{7 6}}})
Adjusts to the previous business day (Monday-Friday). Options: {:weekend-days #{6 7}} to customize weekend
Adjusts to the previous business day (Monday-Friday). Options: {:weekend-days #{6 7}} to customize weekend
(previous-day-of-week value target-day)
Adjusts value to the previous occurrence of the specified day of week. Day: 1=Monday, 2=Tuesday, ..., 7=Sunday
Adjusts value to the previous occurrence of the specified day of week. Day: 1=Monday, 2=Tuesday, ..., 7=Sunday
(start-of-month value)
Adjusts value to the first day of the month at midnight.
Adjusts value to the first day of the month at midnight.
(start-of-quarter value)
Adjusts value to the first day of the quarter.
Adjusts value to the first day of the quarter.
(start-of-week value)
(start-of-week value {:keys [first-day-of-week] :or {first-day-of-week 1}})
Adjusts value to the start of the week (Monday by default). Options: {:first-day-of-week 7} for Sunday start
Adjusts value to the start of the week (Monday by default). Options: {:first-day-of-week 7} for Sunday start
(start-of-year value)
Adjusts value to January 1st at midnight.
Adjusts value to January 1st at midnight.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close