dateTrunc
Returns a date truncated so as to remove specified smaller units.
Example
Truncate the current time, setting hours to 0 (12am).
dateTrunc($currentTime, 'day')
Syntax
dateTrunc(date expr d, string part)
Notes
Returns to the rounded value of a timestamp to the interval needed according to part. Suppose $currenttime_ evaluates to 8/25/19 11:28:44 AM. Then, dateTrunc($currentTime, 'day')
would return 8/25/19 12:00:00 AM.
Allowed values for part are:
- millisecond
- second
- minute
- hour
- day
- month
- year