Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving the date

Status
Not open for further replies.

ThePrince

Programmer
Mar 13, 2003
1
CA
Hi,

I am working on a time sheet and I'd like to be able to retrieve dates automatically after entering the week number in a form.

Is there a way to do this using the datePart or DateDiff or other?

I'd like to say, enter week 5 and have it return the exact date for the Monday of that week.

Thanks in advance,

ThePrince
 
You need to decide firstly how your going to tackle the first week of the year. For example this year falls on a Wednesday, so, does week one have no Monday or does the year start on Monday Jan 6th for your purposes.

Once you have calculated the start date (Monday) you can use the DateAdd function to add the number of weeks so giving the appropriate Monday. e.g.

NewDate = DateAdd("ww", request.form("WeekNo"), StartDate)

Where StartDate has been calculated by your starting criteria.

Hope this helps, BDC.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top