create_exn ~y ~m ~d
creates the date specified in the arguments. Arguments are
validated, and are not normalized in any way. So, days must be within the limits for
the month in question, numbers cannot be negative, years must be fully specified, etc.
Week of the year, from 1 to 53. According to ISO 8601, weeks start on Monday, and the first week of a year is the week that contains the first Thursday of the year. Notice that this means that dates near the end of the year can have week number 1, and dates near the beginning of the year can have week number 52 or 53.
Warning: the triple (year, week number, week day) does not identify a date -- e.g. 2012-01-02 and 2012-12-31 are both Mondays of week 1. (However, if instead of the year, you use the year of the nearest Thursday, then it does work.)
add_weekdays t 0
returns the next weekday if t
is a weekend and t
otherwise.
Unlike add_days this is done by looping over the count of days to be added (forward or
backwards based on the sign), and is O(n) in the number of days to add.
Beware, add_weekdays sat 1
or add_weekdays sun 1
both return the next tue
,
not the next mon
. You may want to use following_weekday
if you want the next
following weekday, following_weekday (fri|sat|sun)
would all return the next mon
.
first_strictly_after t ~on:day_of_week
returns the first occurrence of day_of_week
strictly after t
.
This formats a date using the format patterns available in strftime
.