mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-06 14:14:27 +02:00
Updated Examples and Recipes (markdown)
@@ -115,7 +115,7 @@ The following function will "normalize" a `year_month_day`, much like `mktime` n
|
||||
return ymd;
|
||||
}
|
||||
|
||||
The first line simply adds 0 months to the `ymd`. If `ymd.month()` is 0, with will subtract one from the `year` and set the month to `Dec`. If `ymd.month()` is greater than 12, the year will be incremented as many times as appropriate, and the month will be brought within the proper range. This operation will do nothing if `ymd.month().ok()` is already true.
|
||||
The first line simply adds 0 months to the `ymd`. If `ymd.month()` is 0, this will subtract one from the `year` and set the month to `Dec`. If `ymd.month()` is greater than 12, the year will be incremented as many times as appropriate, and the month will be brought within the proper range. This operation will do nothing if `ymd.month().ok()` is already true.
|
||||
|
||||
The second line will "normalize" the day field. The second line requires that the month field is already normalized. For example `2015_y/dec/32` will become `2016_y/jan/1`. If the day field is already in range, there will be no change.
|
||||
|
||||
|
Reference in New Issue
Block a user