The problem is that you cannot give the CreateDateTime function a '5' 
and expect it to know if you mean AM or PM. The function works only with 
a 24 hour clock. pass it a seventeen (which your second case does since 
hour(now()) equals 17 not 5), and everything works fine.

It's not a bug, just some confusion.

Hope this helps! :o)

Cheers,
Chris

Jacob Munson wrote:
> 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.
>
>   


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:263872
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