Functions for working with dates as numeric quantities.
Compare two dates. This can be used as the compare function for
List.sortWith.
sortedDates = List.sortWith Date.compare unsortedDatesTest if a date is within a given range, inclusive of the range values. The
expression Date.isBetween a b x tests if x is between a and b.
Clamp a date within a given range.
Represents an interval of time.
Test if two dates fall within the same interval.
dec31 = Date.fromCalendarDate 1999 Dec 31
jan1 = Date.fromCalendarDate 2000 Jan 1
Date.equalBy Month dec31 jan1 -- False
Date.equalBy Week dec31 jan1 -- TrueRound down a date to the beginning of the closest interval. The resulting date will be less than or equal to the one provided.
Date.floor Hour (Date.fromParts 1999 Dec 31 23 59 59 999)
-- <31 December 1999, 23:00>Round up a date to the beginning of the closest interval. The resulting date will be greater than or equal to the one provided.
Date.ceiling Monday (Date.fromParts 1999 Dec 31 23 59 59 999)
-- <3 January 2000>Add a number of whole intervals to a date.
Date.add Week 2 (Date.fromParts 2007 Mar 15 11 55 0 0)
-- <29 March 2007, 11:55>When adding Month, Quarter, or Year intervals, day values are clamped at the end of the month if necessary.
Date.add Month 1 (Date.fromParts 2000 Jan 31 0 0 0 0)
-- <29 February 2000>Find the difference, as a number of whole intervals, between two dates.
Date.diff Month
(Date.fromParts 2007 Mar 15 11 55 0 0)
(Date.fromParts 2007 Sep 1 0 0 0 0)
-- 5Create a list of dates, at rounded intervals, increasing by a step value, between two dates. The list will start at or after the first date, and end before the second date.
Date.range Day 2
(Date.fromParts 2007 Mar 15 11 55 0 0)
(Date.fromParts 2007 Mar 22 0 0 0 0)
-- [<16 March 2007>, <18 March 2007>, <20 March 2007>]
Test equality of two dates.