Sign in to follow this  
Followers 0
Clascov

Problem with _DateDiff

4 posts in this topic

#1 ·  Posted (edited)

Sorry, just realised I made a mistake - DOH.

Wish I could delete this post - is that possible ?

Edited by Clascov

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_DateDiff seems to fail for the difference in days if the time is included in the

date/time strings passed AND the first date/time parameter is 'older'.

Tried the code examples below in both v3.2.10.0 and v3.2.11.9 (beta), and all work

as expected except the first where $diff = $error = 0.

Searched the posts without success and would be grateful for a clue.

$diff = _DateDiff("d","2008/07/04 14:07:14","2008/07/05 12:26:54")
MsgBox(0,"","diff = " & $diff & ", error = " & @error)

$age = _DateDiff("d","2008/07/05 12:26:54","2008/07/04 14:07:14")
MsgBox(0,"","diff = " & $diff & ", error = " & @error)

$diff = _DateDiff("d","2008/07/04","2008/07/05")
MsgBox(0,"","diff = " & $diff & ", error = " & @error)

$diff = _DateDiff("d","2008/07/05","2008/07/04")
MsgBox(0,"","diff = " & $diff & ", error = " & @error)[/code

Sorry, just realised my mistake - DOH.
[/quote]

Here:

$diff = _DateDiff("d","2008/07/05","2008/07/04")
MsgBox(0,"","diff = " & $diff & ", error = " & @error)

Start time and end time.

Can we tell us what you resolve?

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Sorry to waste your time Andreik.

Should have realised that start/end datetime was less than 24 hours - so _DateDiff

returned the correct value.

Share this post


Link to post
Share on other sites

Sorry to waste your time Andreik.

Should have realised that start/end datetime was less than 24 hours - so _DateDiff

returned the correct value.

Thanks Clascov!


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0