Skip to main content
Scalar function
With one argument, NULL input returns NULL. Invalid text in AUTO mode returns NULL when ANSI mode is off and raises an error when ANSI mode is on. An explicit constant NULL format raises an error. Avoid NULL values in a format column; their behavior is not reliable.

Syntax

Scalar

Arguments

Returns

  • Type: DATE
  • NULL behavior: With one argument, NULL input returns NULL. Invalid text in AUTO mode returns NULL when ANSI mode is off and raises an error when ANSI mode is on. An explicit constant NULL format raises an error. Avoid NULL values in a format column; their behavior is not reliable.

Properties

Usage notes

  • INTEGER and BIGINT inputs are interpreted as calendar years, not seconds since the Unix epoch.
  • Four-to-seven digit all-numeric strings denote January 1 of a year. Eight-digit YYYYMMDD strings are not silently accepted.
  • With an explicit format, the input is parsed using that format.
  • AUTO parsing and explicit-format parsing have different error rules. See NULL behavior above. ANSI mode is off by default.

Examples

Basic example 1

Basic example 2

Limitations

  • Supply one or two arguments. Multiple alternative format strings are not supported.
  • Explicit-format parsing errors are returned to the caller. A constant NULL format can raise ‘requires at least one non-NULL format’. Avoid NULL values in a format column; their behavior is not reliable.
Last modified on October 15, 2026