Click to See Complete Forum and Search --> : CF DateAdd


moiseszaragoza
06-08-2009, 02:25 PM
I am having a small problem with the DateAdd function.

i need to add 2 month to a particular date but i am getting the date backwors

my code



<cfset date1 = #LSDateFormat(Now(), "mmmm dd, yyyy")# >
<cfset expdate = DateAdd("m", 2, date1)>

<cfoutput>
#date1#
<br />
#expdate#
<br />
</cfoutput>



OUT PUT

June 08, 2009
{ts '2009-08-08 00:00:00'}

So line 1 is right with the proper date format but line # 2 has the year first and thn the month and then the day.
i would like it formated like the original date just 2 month in the future

Thanks

WolfShade
06-11-2009, 03:06 PM
How about..

<cfset todayDate = Now()>
<cfset expireDate = DateAdd(m,2,todayDate)>

<cfset date1 = LSDateFormat(todayDate, "mmmm dd, yyyy") > <!--- you don't need #'s unless the string is within quotes --->
<cfset expdate = LSDateFormat(expireDate, "mmmm dd, yyyy")>

^_^