Can not parse the date field

67 views Asked by At

I have been trying to fix this issue but could not find a solution to it.

I have a date column as string type . Trying to convert it to timestamp using date_parse but getting the following error.

INVALID_FUNCTION_ARGUMENT: Invalid format: "2021-09-28 21:05:28.272159" is malformed at "21:05:28.272159"

my query is

"date_parse"(a.commitdatetime, '%y-%m-%d %h:%i:%s.%f') commitdatetime

do you have any ideas how to fix this issue? Thanks for your time from now

1

There are 1 answers

0
Guru Stron On

Please refer to format strings documentation. %y and %h should be substituted with %Y and %H correspondingly:

select date_parse('2021-09-28 21:05:28.272159', '%Y-%m-%d %H:%i:%s.%f');

Output:

_col0
2021-09-28 21:05:28.272