Using the DateDiff function 
Author Message
 Using the DateDiff function

hello,
We can use the DateDiff function to calculate the
differences between two dates in days, but
failed to get a correct answer when trying to
get a difference between two dates in minutes:

DateDiff("n", Now, olddate)

the above function always produces a
zero result!!! What's wrong???

Any advice, please!

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 the DateDiff function
Is your OldDate variable dimensioned as a date?

I modified this from the Help and it seemed to work fine.

Sub testDatediff()
Dim TheDate As Date    ' Declare variables.
Dim Msg
TheDate = InputBox("Enter a date")
Msg = "Minutes from Now: " & DateDiff("n", Now, TheDate)
MsgBox Msg

End Sub

I can enter just dates (i.e. 6/18/99 )or dates with times (i.e. 6/18/99
8:00 AM).

-Dave



Quote:
> hello,
> We can use the DateDiff function to calculate the
> differences between two dates in days, but
> failed to get a correct answer when trying to
> get a difference between two dates in minutes:

> DateDiff("n", Now, olddate)

> the above function always produces a
> zero result!!! What's wrong???

> Any advice, please!

> Thanks,

> Shicheng

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

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


Tue, 04 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calculating Time Difference using DateDiff Function in VBScript

2. Help with DateDiff function

3. Function DateDiff results as condition

4. Excluding weekends from DateDiff Function

5. DateDiff-function

6. DateDiff in function

7. DateDiff Function

8. Negative values from DateDiff function

9. datediff function

10. DateDiff function

11. About Datediff function

12. Help with the math in a datediff function

 

 
Powered by phpBB® Forum Software