TRUNC
Truncates a numeric value toward zero at the requested scale.
Category: Numeric Functions
Syntax
TRUNC(num, [scale...])
TRUNC(value, unit)
Arguments
- num
numberNumeric value to truncate. - scale
integer[optional | variadic] Decimal scale to keep before truncating toward zero. Optional. Can be repeated. - value
temporalDate, time, or timestamp value to truncate. - unit
varchar[constant] Granularity to truncate to, such asday,month, oryear. Must be a constant expression.
Returns
double — Returns the computed result as double.
timestamp — Returns the computed result as timestamp.
Usage Notes
Truncation is performed toward zero rather than toward negative infinity.
Truncates to the start of the specified unit. The unit argument must be a constant expression.