CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Posts
    84

    datediff and daylight saving

    If you use date diff to find a number of seconds :
    secs=DateDiff("s", #1/1/2000#, Now) does Vb take note of auto daylight saving?
    If you call on this line before and after the clock change, does it return a value less or plus 3600? (which could lead to apps thinking that tomorrow has appeared before the end of today)
    Or is VB sensible and always refers itself to GMT if given a date literal and then automatically adjusts?
    Does anyone know?

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: datediff and daylight saving

    All vb Date functions seem to depend on system settings in one way or another, as far as I've observed. The Format$() function can change the way dates are formatted, but still there are system settings which can effect it. One way to test for DateDiff() and daylight savings would be to get the difference one minute before and after the time change, and see if it accounts for it.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Jun 2002
    Posts
    84

    Re: datediff and daylight saving

    well I just lied to my computer and told it that it was 2 minutes to daylight savings time.
    I then clocked in on a timekeeping app which measures time as seconds from a date literal (in this case #1/1/2000#) . (00:58 gmt)
    After the clock had dutifully jumped forward an hour i clocked out again (02:01 BST)
    When I looked at the time total, the computer had added 3780 seconds.
    So there`s a bit of an answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured