Yeah, if I change the DateDiff to "d" it tells me there is a 12 hour
difference. If I do like so, it is right

<cfset date1 = createODBCDateTime(Now())>
<!--- calculate how many seconds elapsed --->
<cfset diff1 = DateDiff("h",date1,now())>



----- Original Message -----
From: "Jacob Munson" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Tuesday, December 12, 2006 3:33 PM
Subject: DateDiff bug, or am I stupid?


> I brought this up in a previous thread:
> http://www.houseoffusion.com/groups/CF-Talk/thread.cfm/threadid:49106
>
> If you execute this code, changing the 'currentHour' at the top to the
> current hour in your time zone, tell me if diff1 isn't way off (it
> should be 0):
>
> <cfset currentHour = "2">
> <cfset date1 = createDateTime(year(now()),
> month(now()),
> day(now()),
> currentHour,
> minute(now()),
> second(now()))>
> <!--- calculate how many seconds elapsed --->
> <cfset diff1 = DateDiff("s",date1,now())>
>
> <cfset date2 = createDateTime(year(now()),
> month(now()),
> day(now()),
> hour(now()),
> minute(now()),
> second(now()))>
> <!--- calculate how many seconds elapsed --->
> <cfset diff2 = DateDiff("s",date2,now())>
>
> <cfoutput>
> date1: #date1#<br />
> diff1: #diff1#<br />
> date2: #date2#<br />
> diff2: #diff2#
> </cfoutput>
>
> The problem I'm seeing is that the hour from date1 is on the 12 hour
> clock, while date2's hour is on the 24 hour clock.  I'd think CF would
> be able to correctly parse that.  Or am I getting something confused?
> I already know how to work around this, I'm just curious about this
> weird behavior.
>
> On a side note, I tried this on both ColdFusion and BlueDragon and get
> the same results, which makes me think I'm not getting something.
>
> --
> My Sites:
> http://www.techfeed.net/blog/
> http://www.cfquickdocs.com/
> http://cfformprotect.riaforge.org/
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263868
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to