Syntax
Parameters
dt: the time to convert, DATE.INTERVAL N type: the time granularity, for example,interval 5 day.Nis the length of time interval. It must be an INT value.typeis the unit, which can be YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND. Iftypeis set to HOUR, MINUTE, or SECOND for a DATE value, an error is returned.
boundary: optional. It is used to specify whether to return the beginning (FLOOR) or end (CEIL) of the time interval. Valid values: FLOOR, CEIL. If this parameter is not specified,FLOORis the default.
Return value
Returns a value of the DATE type.Usage notes
The time interval starts from A.D.0001-01-01 00:00:00.
Examples
Example 1: Convert a given time to the beginning of a 5-year time interval without specifying theboundary parameter.
test_all_type_select table.