Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Reversing weekdates into 'regular' dates


This topic is 7842 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

One of my clients needs a function in which he can enter a weeknumber and a calc will resolve that weeknumber to a valid date, in the current year.

The outcome of that calc must be so that it is always the sunday in that week. So if he enters 11, it should display the sunday (and date) of week 11, ignoring all other days...

I've been trying all sorts of things but i can't get the calc to work properly... I didnt even start on the 'sunday' thing yet since i can't get the weeknumber reversing done frown.gif

any suggestions?

TIA

JP

Link to comment
Share on other sites

Hi Balooka,

You'll need the Year anyway as the result could be different for any year given, then :

Field yearSpecified (number)

Field weekSpecified (number)

1. Step 1 :

calculate first day of year given

firstDayOf Year = Date("01/01" & yearSpecified)

2. Step 2 :

Calculate first sunday for the year (according to the week - could be a sunday in end Dec 2002 while checking for 2003... EX: 1st Sunday for 2004 will be 12/28/2003)

firstSundayofFirstWeekofYear = firstDayOf Year - MOD(DayofWeek(firstDayOf Year) +6; 7)

Step 3 :

SundayOfWeekGivenofYear = firstSundayofFirstWeekofYear + ((Weekspecified -1) * 7)

or in one calculation

c_firstSundayofWeekofYear = Date("01/01" & yearSpecified) - MOD(DayofWeek(Date("01/01" & yearSpecified)) +6; 7) + ((Weekspecified -1) * 7)

Link to comment
Share on other sites

This topic is 7842 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.