DATE_FORMAT

All functions > DATE AND TIME > DATE_FORMAT

Returns a string from the given timestamp and format.

Signatures

Returns: A formatted string representation of the timestamp

DATE_FORMAT(timestamp: TIMESTAMP, format: VARCHAR) → VARCHAR
sql
ParameterTypeRequiredDescription
timestampTIMESTAMPYesThe TIMESTAMP to format
formatVARCHARYesThe format string (e.g., '%Y-%m-%d')

Notes

  • Formats timestamp according to the specified format string
  • Format uses strftime-style placeholders (e.g., %Y for year, %m for month)
  • Useful for custom date/time string representations
  • Format syntax varies slightly by database engine
  • Common patterns: '%Y-%m-%d' for date, '%H:%M:%S' for time

Examples

FeatureQL
SELECT
    f1 := DATE_FORMAT(FROM_ISO8601_TIMESTAMP('2024-03-15T10:30:45'), '%Y-%m-%d'),  -- Format as date only
    f2 := DATE_FORMAT(FROM_ISO8601_TIMESTAMP('2024-03-15T10:30:45'), '%H:%M:%S')  -- Format as time only
;
Result
f1 VARCHARf2 VARCHAR
2024-03-1510:30:45

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19