Calendar
AdjustDateField
perform calendar arithmetic on individual date fields
Calling Sequence
Parameters
Description
Examples
Compatibility
AdjustDateField( d, field, amount )
d
-
Date; a Date object
field
string; the date field on which to operate
amount
numeric; the amount by which to adjust the indicated field of the date
The AdjustDateField( d ) command operates on individual fields of the Date object d, adjusting (incrementing or decrementing) the indicated field field by the value amount.
There are two methods by which the indicated date field may be adjusted, "add" or "roll".
The "add" method causes an "overflow" of the indicated field to affect successively larger fields of the date. For example, adding 50 days to the day of the month using the "add" method changes the month field, and possibly the year.
The "roll" method applies the indicated adjustment to the indicated date field without affecting other fields of the date. Instead, the amount value is reduced modulo the valid values of field in the case that these are finite in number. For instance, adding 20 to the day of the week is equivalent to adding 6 to the day of the week, because 20 and 6 are equivalent modulo 7.
The field names that can be adjusted by AdjustDateField are as follows.
"ampm"
the meridian (0=am, 1=pm)
"date"
the day of the month
"day_of_month"
the day of the month (synonym for "date")
"day_of_week"
the day of the week (1..7)
"day_of_year"
the numerical day of the entire year
"era"
the era (0=BCE or 1=CE)
"hour"
the hour of the day
"hour_of_day"
the hour of the day (24-hour clock)
the hour of the day (12-hour clock)
"meridian"
the meridian (0=am, 1=pm) (synonym for "ampm")
"millisecond"
the millisecond within the second
"minute"
the minute of the hour
"month"
the month of the year (1=January, .., 12=December)
"second"
the second of the minute
"week_of_month"
the week within the month (1..5)
"week_of_year"
the week within the year (1..53)
"year"
the year
with⁡Calendar:
d≔Date⁡1995,9,23,4,2
d≔<Date: 1995-09-23T04:02:00 GMT>
AdjustDateField⁡d,day_of_week,−3
<Date: 1995-09-20T04:02:00 GMT>
AdjustDateField⁡d,meridian,111
<Date: 1995-11-17T16:02:00 GMT>
The Calendar[AdjustDateField] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Date
Download Help Document