Skip to content
Advertisement

How to convert a date format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive?

How to CONVERT a date in format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive?

I am trying to convert the below list into YYYYMMDD integers

I tried something like this but it doesn’t work

Advertisement

Answer

If you just need to transform your date YYYY-MM-DD into an integer YYYYMMDD why don’t you try to first remove all the occurrences of "-" from the string representation of your date before casting the result to int by using something like this?

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement