Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presto Issue for Time conversion #14706

Open
hitesh1907nayyar opened this issue Jun 23, 2020 · 1 comment
Open

Presto Issue for Time conversion #14706

hitesh1907nayyar opened this issue Jun 23, 2020 · 1 comment

Comments

@hitesh1907nayyar
Copy link

Require your help as stuck in time conversion in presto.

I have a epoch column with name timestamp as a string datatype and i want to convert this into date timestamp.

I have used the below query after reading through various blogs:

SELECT date_parse(to_iso8601(from_unixtime(CAST(timestamp AS bigint)) AS date ,
'%Y-%m-%dT%H:%i:%s.%fZ'))
FROM wqmparquet;
Everytime i run this query i get an error:

INVALID_FUNCTION_ARGUMENT: Invalid format: "2020-04-27T19:49:50.000Z" is malformed at "T19:49:50.000Z"

Can somebody please help me on this.

@mbasmanova
Copy link
Contributor

@hitesh1907nayyar from_unixtime is all you need:SELECT from_unixtime(CAST(timestamp AS bigint)) FROM wqmparquet;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants