Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   Problem with DateDiff in *.vbs - time zones? (http://www.go4expert.com/forums/datediff-vbs-time-zones-t10078/)

JohnRBlackmore 16Apr2008 21:58

Problem with DateDiff in *.vbs - time zones?
 
Hi All,

I've narrowed down an application problem to a strange "DateDiff" outcome.

The following sole lines of code in a *.vbs file:
Dim iDaysToGo
iDaysToGo = DateDiff("h", Now, "01/08/08")
MsgBox "Now = " & Now & Chr(10) & "01-Aug-08 was " & (iDaysToGo * -1) & " days ago. ", , "TIME TEST"

...produced this result today in UK (PASS):
Now = 16/04/2008 11:20:06
01-Aug-08 was -107 days ago

...but this result in today Canada (FAIL):
Now = 2008-04-16 08:21:21
01-Aug-08 was 2443 days ago

Any ideas? Is this a Windows regional setting? Note the date is formatted in reverse.

Thanks,

JB


All times are GMT +5.5. The time now is 15:20.