invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

DATE_ROUND

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> DATE_ROUND[DATE_ROUND]:::quoted
    DATE_ROUND --> End((END))

Purpose

The DATE_ROUND SQL function returns the rounded value of a datetime.

See also DATE_CEIL, DATE_FLOOR and DATE_TRUNC.

Parameters:

  • Precision (varchar2): one of millenium, century, decade, year, quarter, month, week, day, hour, minute, second, milliseconds and microseconds.
  • Date/time (datetime): the date/time to round.

Returns: the rounded with the defined precision of the input date/time as datetime. The original value is returned when an unlisted precision is specified.

Examples

The following example retrieves the rounded value of the system time on millennium basis:

select date_round('millenium', sysdateutc)

-------------------
01-01-2000 00:00:00

The following example retrieves the rounded value of the system time on decade basis:

select date_round('decade', sysdateutc)

-------------------
01-01-2030 00:00:00