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

day´s number

Status
Not open for further replies.

bigdad

Programmer
Jul 17, 2001
34
0
0
VE
Hi everybody: my doubt is about how can I do to know the day´s number from two different date. for example:

My date1 is = 04/25/2002 and my date2 is = 11/14/2002

I need to know the days number lapsed between both. so that how can I do it



Hope that someone can helpme and please excuse me my english but I just talk spanish because I´m a venezuelan people
Thanks
Bigdad

 
bigdad:

The following will return the elapsed days between to date values:

The abs() allows you to have Subtrahends/Minuends of any value in any position.
i.e. subtracting(subtrahend) a later date from an earlier date (minuend)


? abs( ctod("12/31/2000") - ctod("01/01/2000") ) && Non Leap Year
Returns 364

? abs( ctod("12/31/2000")-ctod("01/01/2000") ) && Leap Year
Returns 365

? abs( ctod("01/12/2000") - ctod("12/22/2002") ) && Subtrahend > Minuend
Returns 1075

? ctod("01/12/2000") - ctod("12/22/2002") && Subtrahend > Minuend
Returns -1075


* Assuming two tables related on some key (OrderID most likely) and fields of type date

? Orders.DateSold - Payments.DatePaid
Returns days elapsed between OrderSold and OrderPaid dates


Hope this helps.

Darrell


 
HI

Darrell's methods are ok.. There is no need to use CTOD if the variables are of date type.

Example ..
nDays = Date1 - Date2 ... so long the variables are date type

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top