dateTrunc.php
Table of Contents
Functions
- dateTrunc() : string
- Truncates the given date to the specified unit and returns the modified ISO 8601 date string.
Functions
dateTrunc()
Truncates the given date to the specified unit and returns the modified ISO 8601 date string.
dateTrunc([string|int|null $date = null ][, string|null $unit = DateUnit::MONTH ]) : string
Constructs an AQL expression in the format:
DATE_TRUNC(date, unit)
where date can be a numeric timestamp or ISO 8601 string, and unit specifies
the precision to truncate to.
Supported units (case-insensitive):
- y, year, years
- m, month, months (default)
- d, day, days
- h, hour, hours
- i, minute, minutes
- s, second, seconds
- f, millisecond, milliseconds
Parameters
- $date : string|int|null = null
-
The date to truncate. If null, the current timestamp (
DATE_NOW()) is used. - $unit : string|null = DateUnit::MONTH
-
The time unit to truncate to (default:
"month").
Tags
Return values
string —The AQL expression returning the truncated ISO 8601 date string.