Date conversion in reverse...

D

dforbes1

I need to figure out how to convert a weeknum, day of week("dddd") an
year to a date(mm/dd/yyyy).

ie
Weeknum = 44
Day = Saturday
Year = 2003
answer = 11/1/2003

Any idea on the formula needed?

Thanks
 
B

Bruce M. Thompson

I need to figure out how to convert a weeknum, day of week("dddd") and
year to a date(mm/dd/yyyy).

ie
Weeknum = 44
Day = Saturday
Year = 2003
answer = 11/1/2003

Any idea on the formula needed?

You might try the following (watch line wrap, it's all on one line:

DateAdd("ww",[WeekValue]-1,DateSerial([YearValue],1,1))+([DayOfWeekValue]-Weekda
y(DateAdd("ww",[WeekValue]-1,DateSerial([YearValue],1,1)),vbSunday))

From the debug window (again, watch line wrap):

?
DateAdd("ww",43,DateSerial(2003,1,1))+(7-Weekday(DateAdd("ww",43,DateSerial(2003
,1,1)),vbSunday))
11/1/2003

I have not tested this thoroughly, so you might want to see how this works on a
few values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top