www.webdeveloper.com
Results 1 to 2 of 2

Thread: CF DateAdd

  1. #1
    Join Date
    Feb 2006
    Location
    Ft Lauderdale
    Posts
    299

    CF DateAdd

    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

    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

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    How about..
    Code:
    <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")>
    ^_^

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles