On this page

    Date/Time

    Function NameDescription
    CONVERT_TIMEZONEConvert timestamp to the specified timezone
    CURRENT_DATEReturns the current date of the system.
    CURRENT_DATE_UTCReturns the current date of the system based on the UTC timezone.
    CURRENT_TIMEReturns the current time for the system.
    CURRENT_TIMESTAMPReturns the current timestamp for the system.
    DATE_ADDReturns the sum of two expressions of time as another expression of time.
    DATE_DIFFReturns the difference between two expressions of time as another expression of time.
    DATE_PARTReturn subfields such as year or hour from date or timestamp values
    DATE_SUBReturns the difference of two expressions of time as another expression of time.
    DATE_TRUNCTruncates the date or timestamp to the indicated precision.
    EXTRACTExtracts the specified date or time part from the date or timestamp.
    TIMESTAMPADDAdd (or subtract) an interval of time from a date/timestamp value or column
    TIMESTAMPDIFFReturn the amount of time between two date or timestamp values
    TO_DATEConverts the input expressions to the corresponding date.
    TO_TIMEConverts the input expressions to the corresponding time.
    TO_TIMESTAMPConverts the input expressions to the corresponding timestamp.
    UNIX_TIMESTAMPReturns the Unix timestamp for the timestamp parameter.

    Date/Time Formatting

    Format ElementDescriptionExample
    AD/BCEra indicatorAD, BC
    AMPMMeridian indicatorAM, PM
    CCCentury indicator (0-99)19
    WWWeek of year (0-52)4, 43
    DDay of week (1-7)6
    DYAbbreviated day name of weekTue, Fri
    DAYFull day name of weekTuesday, Friday
    YYYYFour digits of year1996
    YYLast two digits of year96
    DDDDay of year (1-366)5, 245
    MMMonth (1-12)8
    MONAbbreviated month nameMar, Oct
    MONTHFull month nameMarch, October
    DDDay of month (1-31)24
    HH/HH12Hour of day (1-12)4
    HH24Hour of day (0-23)21
    MIMinutes (0-59)22
    SSSeconds (0-59)54
    FFFMilliseconds121
    TZDTimezone abbreviationUTC, PST
    TZOTimezone offset+02:00, -0800

    Only the following characters are allowed in a format pattern: - / , . ; :. If you need to let a value pass through to the output unmodified you can surround it with " (for example "T").

    If you convert a date to text, numeric values are zero padded for you. For example, MM returns 04 for April.