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

NOW

Syntax

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

Purpose

The NOW SQL function returns the time of the system clock in local time at the device where Invantive UniversalSQL runs. It is written as sysdate or localtimestamp without parentheses, or as now(), getdate() or sysdatetime() with parentheses. localtimestamp is the spelling of the SQL standard and is available from release 28.0.

Date arithmetic on the outcome keeps local time: sysdate + 1, sysdate - 1, trunc(sysdate), add_months(sysdate, 1) and dateadd('day', 1, sysdate) all follow the local clock. Up to release 27.0, sysdate - 1 returned the universal time (UTC) one day earlier instead; from release 28.0 it returns the local time one day earlier, like sysdate + 1 already did. A comparison with a UTC date/time, such as modified_utc > sysdate - 1, selects the same rows as before, because the moment in time is the same.

Within one SQL statement the outcome is one moment: every occurrence of sysdate, localtimestamp, now(), getdate() and sysdatetime() in the select list, the where clause, a subquery, an inline view or a view, and in every row, returns exactly the same value, which is the same instant as UTC returns in that statement. Every execution of the statement gets a new moment. In a PSQL block, an evaluation outside a SQL statement, such as l_now := sysdate;, reads the clock anew every time, so two such assignments return different moments; a SQL statement in the block, such as select sysdate into l_now from dual, has one moment of its own. Up to release 27.0, the occurrences within one statement could differ by a fraction of a second.

See also UTC, CURRENT_DATE and LOCALTIME.

Returns: current date/time.

Examples

The following example retrieves the current system date/time in local time as text; the actual value differs per invocation:

select to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS')

-------------------
2026-07-03 09:15:27

The following example retrieves the current system date/time in local time using the alias now():

select to_char(now(), 'YYYYMMDD')

-------------------
20260703

The following example retrieves the same local time one day earlier and the start of the current local day; the actual values differ per invocation:

select to_char(sysdate - 1, 'YYYY-MM-DD HH24:MI:SS')
,      to_char(trunc(sysdate), 'YYYY-MM-DD HH24:MI:SS')

----------------------------------------
2026-07-02 09:15:27 2026-07-03 00:00:00