Home:ALL Converter>Converting timestamp string to timestamp in Presto - Malform error

Converting timestamp string to timestamp in Presto - Malform error

Ask Time:2020-02-12T22:43:38         Author:Albert Ng

Json Formatter

I am trying to convert a timestamp string to timestamp with date_parse, but keep getting an error. Any suggestions? I am working on Presto SQL. I have tried to replace %H:%f with %T and it still doesn't work.

date_parse(sg."@timestamp", '%Y-%m-%d %H:%f')

The error message is:

presto: query failed (200 OK): "USER_ERROR: com.facebook.presto.spi.PrestoException: Invalid format: "2017-12-31 08:29:02.12" is malformed at ":02.12""

Any help would be greatly appreciated, thanks!

Author:Albert Ng,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60190868/converting-timestamp-string-to-timestamp-in-presto-malform-error
yy