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,005 of 10,840   
   Steve Gerrard to Dean Earley   
   Re: DateDiff giving wildly wrong values   
   06 Apr 06 19:17:41   
   
   From: mynamehere@comcast.net   
      
   "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.   
      
   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.   
      
   --- 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