Skip to main content Skip to complementary content

PARSE_DATETIME

Parses a string into a timestamp with time zone using format.

Syntax

PARSE_DATETIME(input, format)

Arguments

Name Type Description Default Value
input string
format string

Returns

Returns a timestamp value.


Examples

input format Output
"2017-09-25 22:11:00" "yyyy-MM-dd HH:mm:ss" timestamp "2017-09-25 22:11:00"
"2018-03-19" "yyyy-MM-dd" timestamp "2018-03-19 00:00:00"
"2018_Mar_21" "yyyy_MMM_dd" timestamp "2018-03-21 00:00:00"
"2018_Mar_21_17:59:05.689" "yyyy_MMM_dd_HH:mm:ss.SSS" timestamp "2018-03-21 17:59:05.689"
"2012/02/22 12:34:56" "Y/MM/d HH:mm:ss" timestamp "2012-02-22 12:34:56"
"01-06-2021" "dd-MM-YYYY" timestamp "2021-06-01 00:00:00"
"01-06-2021" "MM-dd-YYYY" timestamp "2021-01-06 00:00:00"
"2021-05-13 19:02:57.415006+01:00" "YYYY-MM-dd HH:mm:ss.SSSSSSZ" timestamp "2021-05-13 18:02:57.415"

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!