Understanding the usage of the ROUND function
The ROUND
function returns a DATE
value rounded to a specific granularity. It takes two parameters. The first parameter (input_date
) is mandatory and specifies the DATE
value to be rounded. The rounded unit is defined by the second parameter (format
). The second parameter is optional. The default value has day precision. Thus, if the value for the second parameter is not stated, the input date is rounded to the nearest day.
The syntax of the ROUND
function is as follows:
ROUND (<input_date> [, <format>])
The following code snippets show examples of the ROUND
function’s usage related to the DATE
value’s management. The value is rounded down by the day precision specified. As it reflects the morning hours, the returned value is 26.01.2022 00:00:00
:
select ROUND(TO_DATE('26.1.2022 10:15:22', ...