Parse time strings on OPAL

Time in observability data is a complicated subject, and there are a variety of tools for solving specific problems. See Time Functions for an overview of these tools. As a rule, when Observe recognizes a datetime column data type in data, the datetime is set appropriately. However, we often will need to extract dates and times from string columns in the data payload, which is where parse_timestamp and format_time come in.

The parse_timestamp function produces a timestamp column from a formatted string. The format_time function produces a formatted string from a timestamp column.

Differences from other popular datetime formats

Observe uses Snowflake's datetime formats. This table illustrates high level equivalences from other datetime formatting languages you may be familiar with. Be sure to follow the links to see details of acceptable inputs and separators, which differ between environments.

ConceptSnowflake or OPALPython or SPLKusto Query LanguageJava or ElasticJavaScript or Grafana
4-digit yearYYYY%Yyyyyyyyy or YYYYYYYY
4-digit year (ISO)UUUUuuuu
2-digit yearYY%yyyyy or YY or uu
2-digit monthMM%mMMMMMM
Month name (Abbr)MON%bLLL or MMM
Month name (Full)MMMM%BLLLL or MMMM
2-digit day of monthDD%dddddDD
3-digit Day of year%j%jDDD
Weekday name (Abbr)DY%aEEE
2-digit hour (24h)HH24%HHHkkHH
2-digit hour (12h)HH12%Ihhhh
AM / PM indicationAM or PM%pttaa
2-digit minuteMI%Mmmmmmm
2-digit secondSS%Sssssss
fractional secondsFF[0-9]%ff or F (0-7)S (0-3) or nsss
Time zone offsetTZH:TZM or TZHTZM or TZH%zx or X or ZZ[HH:mm]