Using DateDiff to calculate differences in minutes 
Author Message
 Using DateDiff to calculate differences in minutes

Hello,

We couldn't produce the correct result when trying
to calculate time differences between two dates as follows:

    DateDiff("n", Now, olddate)

where "olddate" was the result produced from our issuing the
"Now" function previously; the result from the above
statement always produces a "zero" value!!!

We would appreciate it if anyone could offer us any advice
on how to use the DateDiff function to calculate the difference
in minutes between two dates; both of the two dates are obtained
from issuing the "Now" function.

Thanks,

Shicheng

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Tue, 04 Dec 2001 03:00:00 GMT  
 Using DateDiff to calculate differences in minutes
What type variable is olddate?  I have no problem getting this to work if I
use a Date type variable to store the start time.  If the olddate is a
string then use:

        DateDiff("n", Now, CDate(olddate))

(BTW, the way you have the DateDiff statement written, the answer will always
be a negative number because you have the later date coming before the earlier
date.)

Lee Weiner
weiner AT fuse DOT net
http://home.fuse.net/lweiner

Quote:

>Hello,

>We couldn't produce the correct result when trying
>to calculate time differences between two dates as follows:

>    DateDiff("n", Now, olddate)

>where "olddate" was the result produced from our issuing the
>"Now" function previously; the result from the above
>statement always produces a "zero" value!!!

>We would appreciate it if anyone could offer us any advice
>on how to use the DateDiff function to calculate the difference
>in minutes between two dates; both of the two dates are obtained
>from issuing the "Now" function.

>Thanks,

>Shicheng

>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.



Wed, 05 Dec 2001 03:00:00 GMT  
 Using DateDiff to calculate differences in minutes

The only possible explanation that DateDiff returns ZERO is that the
time elapsed between 'olddate' and 'Now' was less than 1 minute, but
you also need to switch the order of arguments:
DateDiff("n", olddate, Now)

Quote:
>Hello,

>We couldn't produce the correct result when trying
>to calculate time differences between two dates as follows:

>    DateDiff("n", Now, olddate)

>where "olddate" was the result produced from our issuing the
>"Now" function previously; the result from the above
>statement always produces a "zero" value!!!

>We would appreciate it if anyone could offer us any advice
>on how to use the DateDiff function to calculate the difference
>in minutes between two dates; both of the two dates are obtained
>from issuing the "Now" function.

>Thanks,

>Shicheng

>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.



Fri, 07 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Calculating Time Difference using DateDiff Function in VBScript

2. Calculating Time Difference with DateDiff Function in VBScript

3. DateDiff ; X hours Y minutes

4. Calculating Correct Ages & DateDiff

5. Date/Time picker and calculating date differences

6. Calculating Time Differences

7. HELP: Calculating the difference of 2 dates!!

8. How to calculate the difference between two dates (time elapsed between two program starts)

9. How to calculate the difference between txo dates ?

10. calculate difference in time

11. calculating difference in two time's? (hours:minutes)

12. Calculating time differences...How To ?????

 

 
Powered by phpBB® Forum Software