Skip to content
Advertisement

Presto how to find start date given week

I want to find start date from given ISO week (which can range from 1-53, Monday as starting day) and year using Presto SQL query.

i.e. year – 2020 and week – 2 should return 06/01/2020

Is there any inbuilt function for this ?

Table structure:

Advertisement

Answer

There’s no direct way for constructing a date from a year + week (there is an issue for this: https://github.com/trinodb/trino/issues/2287), but you can achieve what you want with the date_parse function.

For example:

produces:

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