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

IS_DATE

Syntax

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

Purpose

The IS_DATE SQL function evaluates to true when a value is representing a valid date/time, based upon the optional format mask. A valid date/time can be cast to a datetime value using TO_DATE.

Parameters:

  • Input (ANY): value to test whether a cast to datetime is possible.
  • Format (optional, varchar2): format mask. Defaults to configured date/time format. The elements of a format mask are described in Format Masks.

Returns: true when the text can be cast to a datetime, false otherwise.

Examples

The following example determines whether '20190101' can be cast to a datetime:

select is_date('20190101', 'YYYYMMDD')

----------------
true

The following example determines whether a number can be cast to a datetime:

select is_date(20190101, 'YYYYMMDD')

----------------
false

The following example determines whether 'nonsense' can be cast to a datetime:

select is_date('nonsense')

----------------
false