I have all week numbers from 20161 to 201640. I want to know what is the start date and end date of week 31.
How can I write query in postgresql to get that?
To get the start date, simply convert the week number to a date using
If you are using ISO week numbers use:
select to_date('201643', 'iyyyiw');
select to_date('201643', 'yyyyww');
To get the end date, just add 7 to resulting date:
to_date('201643', 'iyyyiw') + 7