Shouldn't have to remove the timestamp- DateFormat() will take a Datetime object. What's the error, and are you receiving the error with the code as written, or when you pass a different datetime object than the Now() function?
Matt Osbun Web Developer Health Systems, International -----Original Message----- From: Torrent Girl [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 9:49 AM To: CF-Newbie Subject: RE: HELP (ASAP!!) THANKS! that worked How do I remove the time stamp? I get an error when i add dateformat. >Tested, seems to work okay. I'm baing this off of the Now() function, >but you can substitute any Date object, and the code should work the >same. > ><cfparam name="SomeDate" default="#Now()#"> ><cfparam name="MonthStart" default="#DateAdd("m",-1,SomeDate)#"> ><cfparam name="MonthEnd" default="#DateAdd("m",-1,SomeDate)#"> ><cfparam name="NumDays" >default="#DaysInMonth(DateAdd("m",-1,SomeDate))#"> > ><cfset MonthEnd = >#DateAdd("d",(DaysInMonth(MonthEnd)-Day(MonthEnd)),MonthEnd)#> ><cfset MonthStart = #DateAdd("d",(1-Day(MonthStart)),MonthStart)#> ><cfoutput>#DateFormat(MonthEnd,"mm/dd/yyyy")#</cfoutput> ><cfoutput>#DateFormat(MonthStart,"mm/dd/yyyy")#</cfoutput> > >Matt Osbun >Web Developer >Health Systems, International > > >-----Original Message----- >From: Torrent Girl [mailto:[EMAIL PROTECTED] >Sent: Thursday, May 19, 2005 12:51 AM >To: CF-Newbie >Subject: Re: HELP (ASAP!!) > > >I am not getting it. > >I need an actual date. > >I need to calculate and output the first and last date of the previous >month for any given month. In date format, not number of days. > > >This - #DaysInMonth(now())# returns the # of days (31) > >and this #01/#Month(now())#/#Year(Now())# gives me an error. > > > >On 5/19/05, Andrew Scott <[EMAIL PROTECTED]> wrote: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:983 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
