Don't really understand your question but I find the easiest way to deal
with dates is:
Let the user enter the date in whatever format is familiar to them (if
possible use the SelectDate - below - to eliminate any confusion).
Convert the date into a ColdFusion datetime object.
Wrap ODBCDateTime() around it when inserting/updating the database.
Set the locale for the user.
Output using LSDateFormat().
Job done.
SelectDate.cfm
========================
<cfsetting enablecfoutputonly="Yes">
<!--- cf_SelectDate v1.4
11th September 2001
Aidan Whitehall, [EMAIL PROTECTED]
SelectDate creates three form inputs to allow the user to specify
a date:
<cf_SelectDate
Display="day/month/year - specify which inputs to display
(displays all by default)"
Date="the preselected date (defaults to today)"
YearFrom="year the select range starts from (defaults to
1900)"
YearTo="year the select range ends (defaults to this year)"
Padding="yes|no" whether the day and month values are padded
with zeroes
Suffix="adds different suffixes to form inputs for calling
SelectDate more than once in a template"
Class="adds a CLASS attribute to all drop-down lists"
TabIndex="what value to start the TABINDEX attribute from">
Notes: add JavaScript or validate the submission to ensure a valid
date is submitted
Example:
<cf_SelectDate
Date="#GetDate.Date#"
Suffix="1"
TabIndex="5"> --->
<cfparam name="Attributes.Display" type="string"
default="day,month,year">
<cfparam name="Attributes.Date" type="date" default="#Now()#">
<cfparam name="Attributes.YearFrom" default="#DateAdd("y", -1,
Year(Now()))#">
<cfparam name="Attributes.YearTo" default="#Year(Now())#">
<cfparam name="Attributes.Padding" type="boolean" default="false">
<cfparam name="Attributes.Suffix" type="string" default="">
<cfparam name="Attributes.Class" type="string" default="">
<cfparam name="Attributes.TabIndex" type="numeric" default="1">
<cfset TabIndex = Attributes.TabIndex>
<cfif ListFind(Attributes.Display, "day")>
<cfoutput><select name="Day#Attributes.Suffix#"<cfif
Len(Attributes.Class)> class="#Attributes.Class#"</cfif><cfif
Len(Attributes.TabIndex) AND IsNumeric(Attributes.TabIndex)>
tabindex="#TabIndex#"</cfif>></cfoutput>
<cfloop from="1" to="31" index="Day">
<cfoutput><option value="<cfif
Attributes.Padding>#NumberFormat(Day, "00")#<cfelse>#Day#</cfif>"<cfif
Day is Day(Attributes.Date)>
selected="selected"</cfif>>#Day#</OPTION></cfoutput>
</cfloop>
<cfoutput></SELECT></cfoutput>
<cfset TabIndex = IncrementValue(TabIndex)>
</cfif>
<cfif ListFind(Attributes.Display, "month")>
<cfoutput><select name="Month#Attributes.Suffix#"<cfif
Len(Attributes.Class)> class="#Attributes.Class#"</cfif><cfif
Len(Attributes.TabIndex) AND IsNumeric(Attributes.TabIndex)>
tabindex="#TabIndex#"</cfif>></cfoutput>
<cfloop from="1" to="12" index="Month">
<cfoutput><option value="<cfif
Attributes.Padding>#NumberFormat(Month,
"00")#<cfelse>#Month#</cfif>"<cfif Month is Month(Attributes.Date)>
selected="selected"</cfif>>#MonthAsString(Month)#</OPTION></cfoutput>
</cfloop>
<cfoutput></SELECT></cfoutput>
<cfset TabIndex = IncrementValue(TabIndex)>
</cfif>
<cfif ListFind(Attributes.Display, "year")>
<cfoutput><select name="Year#Attributes.Suffix#"<cfif
Len(Attributes.Class)> class="#Attributes.Class#"</cfif><cfif
Len(Attributes.TabIndex) AND IsNumeric(Attributes.TabIndex)>
tabindex="#TabIndex#"</cfif>></cfoutput>
<cfloop from="#Attributes.YearFrom#" to="#Attributes.YearTo#"
index="Year">
<cfoutput><option value="#Year#"<cfif Year is
Year(Attributes.Date)>
selected="selected"</cfif>>#Year#</OPTION></cfoutput>
</cfloop>
<cfoutput></SELECT></cfoutput>
<cfset TabIndex = IncrementValue(TabIndex)>
</cfif>
<cfset Caller.TabIndex = TabIndex>
<cfsetting enablecfoutputonly="No">
--
Aidan Whitehall <[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]