1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Problem with DateDiff in *.vbs - time zones?

Discussion in 'Visual Basic ( VB )' started by Iona, Apr 16, 2008.

  1. Iona

    Iona New Member

    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.



Share This Page