thanks will try this...

>When you use CreateODBCDate and pass in a string it will first try to
>convert it to a date using the US format of mm/dd/yyyy, and only if that
>fails will it try the "rest-of-the-world" format of dd/mm/yyyy. The same
>goes for some of the other CF date functions.
>So 12/13/2009 and 13/12/2009 will both get converted to 13th Dec 2009.
>:|
>
>IMO, the safest way to deal with dates coming in as strings (e.g. from forms
>etc) is to convert them to CF dateobjects using CreateDate as soon as you
>can using something like the following, though the error handling would
>obviously do something more friendly than just abort.
>
><cftry>
>    <cfset myDateObject = CreateDate(ListGetAt(form.dateString, 3, '/'),
>ListGetAt(form.date, 2, '/'), ListGetAt(form.date, 1, '/'))>
>    <cfoutput>#myDateObject#</cfoutput>
>    <cfcatch>
>        <cfabort showerror="i couldn't make a date out of form.date...">
>    </cfcatch>
></cftry>
>
>Assuming that the datatype of your dB column is DATETIME, you'll want to do
>something similar when displaying the date you pull out of the database,
>this time using DateFormat(yourDate, 'dd/mm/yyyy'). (N.B. DateFormat should
>be used to display a date object in a particular format, and not to try to
>create a date object from a string in a particular format...)
>
>As Peter mentioned, where possible it is preferable to use mmm is any dates
>you display to the end user as this removes any ambiguity between dd/mm vs.
>mm/dd: everyone understands Jan 2 2009 and 2 Jan 2009.
>
>Cheers
>Bert
>
>
>
>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321409
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