ok, so now using those values to set selects to today's date:
<cfset date = '#DateFormat('#CreateODBCDate(Now())#', 'yyyy-mm-dd')#'>
<cfset testday = #DatePart('d', date)#>
<cfset testmonth = #DatePart('m', date)#>
<cfset testyear = #DatePart('yyyy', date)#>
<cfset nextyear = NumberFormat(Evaluate(testyear+2), "0000")>
<cfoutput>
testday: #testday#<br>
testmonth: #testmonth#<br>
testyear: #testyear#<br>
</cfoutput>
<form>
<select>
<option value="null">please choose a month</option>
<cfloop from="1" to="12" index="m">
<cfoutput>
<option value="#m#" <cfif m IS
#testmonth#>selected</cfif>>#monthasstring(m)#</option>
</cfoutput>
</cfloop>
</select>
<br><br>
<select>
<option value="null">please choose a day</option>
<cfloop from="1" to="31" index="d">
<cfoutput>
<option value="#d#" <cfif d IS
#testday#>selected</cfif>>#Day(d)#</option>
</cfoutput>
</cfloop>
</select>
<br><br>
<select>
<option value="null">please choose a year</option>
<cfloop from="#testyear#" to="#nextyear#" index="y">
<cfoutput>
<option value="#y#" <cfif y IS #testyear#>selected</cfif>>#y#</option>
</cfoutput>
</cfloop>
</select>
</form>
which outputs this:
testday: 7
testmonth: 1
testyear: 2003 // which is all OK
but the values selcted in the drop downs are 'January' (which is right), '6'
(!wrong - out by a day) and '2003' (correct).
anyone an idea why it's 6, not 7 as it should be? I tried looping from 0 to
31, no difference...
ta again
Ian W
----- Original Message -----
From: "Ian Westbrook" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 11:07 AM
Subject: Re: [ cf-dev ] splitting up date string...
> will try (and see other post).
>
> ta
>
> Ian W
> ----- Original Message -----
> From: "Martin Gill" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 07, 2003 11:05 AM
> Subject: RE: [ cf-dev ] splitting up date string...
>
>
> Personally I'd use
>
> <CFSET YYYY = ListGetAt(dateString, 1, '-')>
> <CFSET MM = ListGetAt(dateString, 2, '-')>
> <CFSET DD = ListGetAt(dateString, 3, '-')>
>
> Providing that the date strings were all in a consistant format.
>
>
> Hope This Helps
>
> Martin L. Gill, MSc - Programmer
>
> For & on Behalf of UniTech
> (The Universal Information Technology Group Ltd)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> URL: http://www.unitech.net
> Email: [EMAIL PROTECTED]
>
> UniTech House, 25 Bernard Street, Leith, Edinburgh, EH6 6SH
> Tel: +(44) 0131 472 5555
> DDI: +(44) 0131 472 5560
> Fax: +(44) 0131 472 5556
>
>
>
>
> -----Original Message-----
> From: Ian Westbrook [mailto:[EMAIL PROTECTED]]
> Sent: 07 January 2003 10:59
> To: cfug dev list
> Subject: [ cf-dev ] splitting up date string...
>
>
> Hi
> got a date astring like 2003-01-07, and I want to split it into its
> constituent parts (ie '2003', '01' and '07'). Can anyone tell me which
> function I should be using? I've had a flick through the book, obviously
> missing what I need...
>
> TIA
>
> Ian W
>
> Ian Westbrook,
> FutureDream Media Limited,
> (W): www.futuredream.net
> (E): [EMAIL PROTECTED]
> (T): +44 (0) 1303 258 985
> (M): 07939 510 812
>
> This message may contain information which is legally privileged and/or
> confidential. If you are not the intended recipient, you are hereby
> notified that any unauthorised disclosure, copying, distribution or use
> of this information is strictly prohibited. Such notification
> notwithstanding any comments, opinions, information or conclusions
> expressed in this message are those of the originator, not of
> FutureDream Media Ltd, unless otherwise explicitly and independently
> indicated by an authorised representative of FutureDream Media Ltd.
>
>
> --
> ** 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]
>
>
>
> --
> ** 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]
>
--
** 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]