It looks like the times are off by 1 hour.  Did you check your server's
clocks to make sure they are both set to the same time?



-----Original Message-----
From: Ruslan Sivak [mailto:cfli...@ruslansivak.com] 
Sent: Thursday, June 09, 2011 9:43 PM
To: cf-talk
Subject: DateDiff Weirdness/Possible bug


I'm having trouble with different results for DateDiff between CF and SQL
Server.  I'm guessing it has something to do with DST, but it seems that CF
is doing it wrong.

Doing a SQL Query like this:

select DateDiff(s,'1/1/1970','6/1/2011') as datediff

I get 1306886400.

Doing

<cfdump var="#DateDiff(s,'1/1/1970','6/1/2011')#">

I get 1306882800.

Converting SQL's result back to Date using CF:

#dateAdd('s',1306886400,'1/1/1970')#

I get  {ts '2011-06-01 01:00:00'}

According to http://www.epochconverter.com/, 1306886400 is the correct
number of seconds for midnight on June 1st, 2011.

Is there a reason that CF is returning the wrong number of seconds?

Russ




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345141
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to