Home > tips > Calculate date from week of year, or week to date

Calculate date from week of year, or week to date


Useful solution for finding the date of first day of a given week, and year.

select decode(to_Char(to_date(’01-JAN-‘||&Cur_year),’DY’),’MON’, to_date(’01-JAN-‘||&Cur_year),next_day(to_date(’01-JAN-‘||&Cur_year),’MON’))+(7*(&cur_week-1)) from dual

Value of Cur_year may be any year and Cur_week must be between 1-52.

Thank you Sandy for this solution.  

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Don Charisma

because anything is possible with Charisma

Carol no Mundo!

Aventuras de uma intercambista a trabalho pelo mundo!

Blog do PHP

Oracle DBA for rookies!

nimaidba

Welcome to the world of Oracle with me....

Tech

News and reviews from the world of gadgets, gear, apps and the web

WordPress.com

WordPress.com is the best place for your personal blog or business site.

Gurcan Orhan's ODI and DWH Blog

Some words about Oracle Data Integrator and Data Warehousing.

%d bloggers like this: