pigmentarts
asked on
simple DATEFORMAT query
i need to get the all 12 months from my date (thisMonth) and output them to screen, thanks
<cfset thisMonth = #DATEFORMAT(now(), "dd/mm/yyyy")#>
<cfset thisMonth = #DATEFORMAT(now(), "dd/mm/yyyy")#>
ASKER
1 months from the current date i have managed to do it like this... not sure if its the best way but works
<cfset thisMonth = #DATEFORMAT(now(), "mmmm/yyyy")#>
<cfscript>
thisMonth = #DATEFORMAT(now(), "mmmm/yyyy")#;
WriteOutput("#thisMonth#<b r />");
// output the loop index in each iteration
for (idx = 1; idx lte 12; idx = idx +1) {
paMonths = #DateFormat(DateAdd('m', -#idx#, thisMonth),'mmmm/yyyy')#;
WriteOutput("#paMonths#<br />");
}
</cfscript>
<cfset thisMonth = #DATEFORMAT(now(), "mmmm/yyyy")#>
<cfscript>
thisMonth = #DATEFORMAT(now(), "mmmm/yyyy")#;
WriteOutput("#thisMonth#<b
// output the loop index in each iteration
for (idx = 1; idx lte 12; idx = idx +1) {
paMonths = #DateFormat(DateAdd('m', -#idx#, thisMonth),'mmmm/yyyy')#;
WriteOutput("#paMonths#<br
}
</cfscript>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks Zvonko
can you clarify that, please?