home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,011 of 10,840   
   Dean Earley to Steve Gerrard   
   Re: DateDiff giving wildly wrong values   
   10 Apr 06 16:57:31   
   
   From: dean.earley@icode.co.uk   
      
   Steve Gerrard wrote:   
   > "Dean Earley"  wrote in message   
   > news:44351100$0$673$fa0fcedb@news.zen.co.uk...   
   >> Rick Rothstein wrote:   
   >>>>> I have the following code to get the number of seconds into a day given   
   >>>>> a date/time value:   
   >>>>>   
   >>>>> TValS = DateDiff("s", DateValue(StillDate), StillDate)   
   >>>> Is StillDate a String or a Date ?   
   >   
   > DateValue takes a string, not a Date. So you have an implicit conversion from   
   > Date to String, prior to the conversion by DateValue back to a Date. It would   
   > seem that the implicit conversion is producing a string in a different date   
   > format on the 3 unhappy machines.   
      
   We've got a response back from the user saying that their short date   
   format was "M/dd/yyyy" which would explain this. Changing back to   
   "dd/mm/yyyy" sorted it.   
      
   We originally thought DateValue was returning correct values as his   
   debug output was showing "5/4/2006" which while looking correct to us,   
   was in the US format...   
      
   > You might first try DateDiff("s", DateValue(CStr(StillDate)), StillDate) to   
   see   
   > if you can make the conversion more consistent, or at least to make clear   
   what   
   > conversions are actually taking place.   
   >   
   > My preference would be DateDiff("s", Fix(StillDate), StillDate), leaving   
   strings   
   > out of the deal.   
      
   I assumed (From MSDN) that it accepted date values so was unambiguous   
   anyway. I will now try Int() to see how that performs.   
      
   Thanks   
      
   --   
   Dean Earley (dean.earley@icode.co.uk)   
   i-Catcher Development Team   
      
   iCode Systems   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca