presumably it's guessing that you mean 3rd April, not April 2003, and is defaulting to the current year. So I guess just pass your year as 4 digits instead of 2 to clear it up.
Mark Smyth <[EMAIL PROTECTED]>
26/04/2004 09:17
|
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject: RE: [ cf-dev ] Dateformat wierdness |
I think i've found what it is, its the format of the date i'm converting
If I run the following code
<cfset hs = #dateformat("Apr-03", "mm yy")#>
<cfoutput>#hs#</cfoutput>
I get 04-04
Whereas If I change the date being converted to a having a 4 digit year
<cfset hs = #dateformat("Apr-2003", "mm yy")#>
It outputs the correct date..... 04-03
Could someone else run the code and see if they get the same output?
Thanks
Mark
-----Original Message-----
From: Mark Smyth [mailto:[EMAIL PROTECTED]
Sent: 23 April 2004 15:47
To: '[EMAIL PROTECTED]'
Subject: RE: [ cf-dev ] Dateformat wierdness
I've dumped the array and its fine
so is the list resulting from arratytolist
It only occurs when I use dateformat within the list loop!
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 23 April 2004 15:45
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] Dateformat wierdness
so either the error is when the dates are being inserted to the array, or when the array is converted to a list. you tried looping through the array, outputting it's values?
Mark Smyth <[EMAIL PROTECTED]>
23/04/2004 16:37 | To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject: RE: [ cf-dev ] Dateformat wierdness |
when i output #dateformat(i,"mm yyyy")#
within the loop the years are all changed to 2004....
-----Original Message-----
From: Mark Smyth [mailto:[EMAIL PROTECTED]
Sent: 23 April 2004 15:29
To: '[EMAIL PROTECTED]'
Subject: RE: [ cf-dev ] Dateformat wierdness
sorry, my typo. was playing around with it to see if it was date mask specific
the datemask i'm actually using is
mmmm yyyy
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 23 April 2004 15:27
To: [EMAIL PROTECTED]
Subject: Re: [ cf-dev ] Dateformat wierdness
Does dateformat(i,"mm yyyy")
really give you:
April 2004,July 2004,October 2004,January 2004
? I'd expect 04 2004, 07 2004, 10 2004, etc. You said outputting #i# was correct, did you try outputting #dateformat(i,"mm yyyy")#?
Mark Smyth <[EMAIL PROTECTED]>
23/04/2004 16:20 | To: [EMAIL PROTECTED] cc: Subject: [ cf-dev ] Dateformat wierdness |
Hi, this is weird
I have an array with the following dates
Apr-03
Jul-03
Oct-03
Jan-04
I put them into a list using arraytolist (cause i'm appending it to a CSV file and its easier).
<cfset dList=#arraytolist(datearr)#>
Which gives me:
Apr-03,Jul-03,Oct-03,Jan-04
I then create a new list and loop over #dList# to create a list with formatted dates
<cfset dList2="">
<cfloop index="i" list="#dlist#">
<cfset dList2 = listappend(dList2, dateformat(i,"mm yyyy"))>
</cfloop>
But if I then output dList2 I get
April 2004,July 2004,October 2004,January 2004
All the years have been change to 2004! But if I output #i# in the loop it leaves the years unaltered, it looks like listappend is throwing a spanner in the works
Anyone see anything i'm doing wrong or is it a bug?
Thanks
Mark