try this instead as it's better coding practice. You don't need all those
hashes when using them in variables or functions, and it's better for
performance...
<cfset testdate = DateFormat(CreateODBCDate(Now()), 'yyyy-mm-dd')>
<cfset testday = DatePart('d', date)>
<cfset testmonth = DatePart('m', date)>
<cfset testyear = DatePart('yyyy', date)>
Or you could try (easier to read and probably slightly better on
performance):
<cfscript>
testdate = DateFormat(CreateODBCDate(Now()), 'yyyy-mm-dd');
testday = DatePart('d', date);
testmonth = DatePart('m', date);
testyear = DatePart('yyyy', date);
</cfscript>
note I changed your variable Date to testdate as it's a reserved word...
----- 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...
> hmm, that kind of does it:
>
> <cfset date = '#DateFormat('#CreateODBCDate(Now())#', 'yyyy-mm-dd')#'>
> <cfset testday = #DatePart('d', date)#>
> <cfset testmonth = #DatePart('m', date)#>
> <cfset testyear = #DatePart('yyyy', date)#>
>
> testday: 7
> testmonth: 1
> testyear: 2003
>
> which suits my purposes, although not if I wanted 07, 01 etc...
>
> I'll have a look at the List functions, and also the other code posted.
>
> ta ;-)
>
> Ian
>
> ----- Original Message -----
> From: "Adrian Lynch" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 07, 2003 11:03 AM
> Subject: RE: [ cf-dev ] splitting up date string...
>
>
> > DatePart(), or use List functions to tear it apart.
> >
> > Ade
> >
> > -----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]
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
** 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]