dateAdd.php
Table of Contents
Functions
- dateAdd() : string
- Adds a specified amount of time to a given date and returns the resulting ISO 8601 date string.
Functions
dateAdd()
Adds a specified amount of time to a given date and returns the resulting ISO 8601 date string.
dateAdd(string|int|null $date, string|int $amount[, string $unit = DateUnit::DAY ]) : string
Constructs an AQL expression in the format:
DATE_ADD(date, amount, unit)
where date can be a numeric timestamp or ISO 8601 string, amount is the number
of units to add (or subtract if negative), and unit specifies the time unit.
Supported units (case-insensitive):
- y, year, years
- m, month, months
- w, week, weeks
- d, day, days
- h, hour, hours
- i, minute, minutes
- s, second, seconds
- f, millisecond, milliseconds
Parameters
- $date : string|int|null
-
Numeric timestamp or ISO 8601 date string. Defaults to
DATE_NOW()if null. - $amount : string|int
-
Number of units to add (positive) or subtract (negative). Positive values recommended.
- $unit : string = DateUnit::DAY
-
Time unit to add (default:
"day").
Tags
Return values
string —The AQL expression returning the calculated ISO 8601 date string.