In CF8 <cfset myDate = createDate(2010,3,14) /> <cfdump var="#myDate#" /><br /> UTC<cfdump var="#GetHttpTimeString(myDate)#" /><br /><br />
<cfset myDate2 = DateAdd('s',1271779666,myDate) /> <cfdump var="#myDate2#" /><br /> UTC<cfdump var="#GetHttpTimeString(myDate2)#" /><br /><br /> <cfset myDate = createDate(2010,3,15) /> <cfdump var="#myDate#" /><br /> UTC<cfdump var="#GetHttpTimeString(myDate)#" /><br /><br /> <cfset myDate2 = DateAdd('s',1271779666,myDate) /> <cfdump var="#myDate2#" /><br /> UTC<cfdump var="#GetHttpTimeString(myDate2)#" /><br /><br /> Output was: {ts '2010-03-14 00:00:00'} UTC Sun, 14 Mar 2010 05:00:00 GMT {ts '2050-07-01 17:07:46'} UTC Fri, 01 Jul 2050 21:07:46 GMT {ts '2010-03-15 00:00:00'} UTC Mon, 15 Mar 2010 04:00:00 GMT {ts '2050-07-02 16:07:46'} UTC Sat, 02 Jul 2050 20:07:46 GMT ---- Tom McNeer <tmcn...@gmail.com> wrote: > > Okay, > > So - it wasn't a JVM issue. Updating it did not change the results. > > And Steve was right, in a way. But I still don't understand why it should be > this way. > > First, Steve, I understand what you're saying about "whenever you display a > time." But in practice, I'm not displaying a time at all. I'm simply > creating a date/time value and adding a number of seconds to it, then > inserting into a database. > > So to my way of thinking - and according to every doc I've ever read - the > dateAdd function should do exactly what you tell it to do: just add the > increments to the original date. > > But what's happening DOES involve DST - though not the time zone. I don't > know why. It shouldn't. But it does, at least in CF9. > > Try this for yourself: Daylight Savings Time began at 2:00 AM Eastern on > March 14, 2010. So run the following: > > <cfset myDate = createDate(2010,3,14) /> > <cfdump var="#myDate#" /><br><br> > <cfset myDate2 = DateAdd('s',1271779666,myDate)> > <cfdump var="#myDate2#" /><br><br> > > myDate is two hours _before_ DST went into effect. On two different CF9 > servers, one on EDT, the other on CDT, the result for myDate2 was: > {ts '2050-07-01 17:07:46'} > > Now change the createDate to (2010,3,15) - _after_ DST went into effect. On > the same servers, the result was: > {ts '2050-07-02 16:07:46'} > > The original date was changed by a day. But the result of the dateAdd > statement changed by 23 hours. > > I wish I could test this on CF8 and/or 7, but the only servers with those > versions to which I have access are in Arizona, where they don't use DST. > Those servers return the 16:07:46 timestamp. But without having the machines > set to DST, I can't tell if CF is acting differently or not. -- http://www.linkedin.com/pub/roger-austin/8/a4/60 http://twitter.com/RogerTheGeek http://www.misshunt.com/ Home of the Clean/Dirty Magnet http://www.ncdevcon.com/ TACFUG 2010 Conference in North Carolina ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333092 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm