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

DATE_CEIL

Syntax

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

Purpose

The DATE_CEIL SQL function returns the ceiling value of a datetime.

See also DATE_FLOOR, DATE_ROUND and DATE_TRUNC.

Parameters:

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

Returns: the ceiling 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 ceiling value of the system time using millennium precision:

select date_ceil('millenium', sysdateutc)

-------------------
01-01-3000 00:00:00

The following example retrieves the ceiling value of the system time using month precision:

select date_ceil('month', to_date('19870315', 'YYYYMMDD'))

-------------------
01-04-1987 00:00:00

The following example retrieves the ceiling value of Thursday 1 October 2026 on week basis; a week starts on Sunday:

select date_ceil('week', to_date('20261001', 'YYYYMMDD'))

-------------------
04-10-2026 00:00:00