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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Dates

Status
Not open for further replies.

devinci

MIS
Feb 15, 2002
46
0
0
CA
Hi...I'm trying to figure out the best way to code this...

I have a certain date, let say 05/14/02, I'm trying the get the exact date after 20 weeks from that date.

Any help would be greatly appreciated....Thanks
 
The DateAdd function may be helpful.

NewDate = DateAdd("ww", 20, CurrentDate)

This should add exactly 20 weeks Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Just the code
[tt]
Dim MyDate as Date
Dim MyNewDate as Date
Dim MyInterval as Integer

MyDate = 05/14/02 'Start date
MyInterval = 20 * 7 '20 Weeks

MyNewDate = DateAdd("d", MyDate, MyInterval)
[/tt] Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Cajun, I guess you could just add the weeks LOL , I just like to complicate things too much... Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Thanks guys...

This was pretty helpful...didn't think it was that easy.
 
After coding in QuickBasic (VB's "mother tongue"), then C/C++, I find almost everything is way easier in VB then it ever was before. "It's got to be the going,
not the getting there that's good!"
-Harry Chapin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top