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

Date Substraction

Status
Not open for further replies.

EKC

Technical User
Jan 13, 2001
43
CA
Hi,
I need to figure out number of weeks between 2 dates user enter into two TextBoxes on a form.Value user enter into those text boxes are stored in Public variable tdDateFrom and tdDateTo (variables are ControlSource for those text boxes).I tried
n=Int(Week(tdDateTo)-Week(tdDateFrom)) but doesn't work.
The "n" is going to be used later in loop constuct.


The second question is :From dates user enter in text boxes(when user select Monthly instead Weekly option)I need to figure out last day of that month.For example is user enter today's date 4/9/01 I need to get 4/30/01

Thanks for any help
Lyn
 
You can use
n = WEEK(toDateTo) - WEEK(toDateFrom)
provided toDateTo and toDateFrom are Date variables. You might be having these as YYYY-MM-DD-HH-SS format.
Set the variables to DATE type, your function will work.
**
For last day of the month
LastDay = GOMONTH(date() - day(date()) + 1, 1) - 1
**
Hope this helps :)
ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top