• Status: Solved
• Priority: Medium
• Security: Public
• Views: 1311

# To get this year/week start date and end date from Year & Week No?

My input is Year and Week No.  How to get this year/week start date and end date?
0
sboscoi
1 Solution

Commented:
year start = trunc(to_date(in_year,'yyyy'),'yyyy')

week start/week end - this is tricky,  what do you consider the start of a week?

if weeks count from day 1 of the year, then try this...

week start = trunc(to_date(in_year,'yyyy'),'yyyy') + (7 * (in_week - 1))
week end =  trunc(to_date(in_year,'yyyy'),'yyyy') + (7 * (in_week - 1)) + 6

if weeks count from the first Monday of the week (ISO weeks)

week start = next_day(trunc(to_date(in_year,'yyyy'),'yyyy') -1,'Mon') + (7 * (in_week - 1))
week end = next_day(trunc(to_date(in_year,'yyyy'),'yyyy') -1,'Mon') + (7 * (in_week - 1)) + 6

if weeks count from some other rule, post what you're using and I'll try to figure out how to represent it
0

Author Commented:
Brilliant.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.