TO_TIMESTAMP
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Converts a formatted string to a timestamp with time zone value according to the supplied format pattern.
<string>: Atextvalue representing the timestamp to parse.<format_pattern>: Atextvalue specifying the format of the input string. Template pattern characters in the format string identify the corresponding parts of the input value.
Returns timestamp with time zone.
Returns NULL if either argument is NULL.
- For supported format pattern characters and modifiers, see TO_CHAR.
- Use
TO_TIMESTAMPwhen a simple cast can’t handle your input format. For most standard date/time formats, cast the source string directly totimestampwithoutTO_TIMESTAMP. - The
YYYYpattern can’t process a year with more than four digits. Use a non-digit separator afterYYYYfor longer year values. For example,to_timestamp('20000-11-30', 'YYYY-MM-DD'). - Millisecond (
MS) and microsecond (US) fields are treated as the fractional seconds digits after the decimal point. For example,to_timestamp('12.3', 'SS.MS')produces 12.300 seconds (300 milliseconds), not 12.003. - ISO 8601 week-numbering fields (
IYYY,IW,ID,IDDD) can’t be mixed with Gregorian date fields in the same call.
Convert a human-readable date string to a timestamp with time zone.
Returns 2000-12-05 00:00:00+00.
Convert a string that includes time and time zone offset components.
Returns 2024-03-15 14:30:00-07.