TRUNC_TIMESTAMP

The TRUNC_TIMESTAMP function returns a timestamp that is the expression truncated to the unit specified by the format-string. If format-string is not specified, expression is truncated to the nearest day, as if 'DD' was specified for format-string.

Read syntax diagramSkip visual syntax diagram
                                   .-,--'DD'----------.      
>>-TRUNC_TIMESTAMP--(--expression--+------------------+--)-----><
                                   '-,--format-string-'      

expression
An expression that returns a value of one of the following built-in data types: a timestamp, a character-string, or a graphic-string.
If expression is a character or graphic string, it must not be a CLOB or DBCLOB and its value must be a valid string representation of a timestamp. For the valid formats of string representations of timestamps, see String representations of datetime values.
format-string
An expression that returns a built-in character string data type or graphic string data type. format-string contains a template of how the timestamp represented by expression should be truncated. For example, if format-string is 'DD', the timestamp that is represented by expression is truncated to the nearest day. Leading and trailing blanks are removed from the string, and the resulting substring must be a valid template for a timestamp. The resulting value is then folded to uppercase, so the characters in the value may be in any case. Allowable values for format-string are listed in Table 1.

The result of the function is a TIMESTAMP. If either argument can be null, the result can be null; if either argument is null, the result is the null value.

Example