You have to parse "20070927" into a date object, something like:

<cfset dt_str = "20070827" />
<cfset dt = CreateDate(Left(dt_str, 4), Mid(dt_str, 5, 2),
Right(dt_str,2)) />



-----Original Message-----
From: Orlini, Robert [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 28, 2007 8:51 AM
To: CF-Talk
Subject: RE: minus 30

1 month is fine.

enddate is 20070927 (for now) and is a string: I get: 568511220 as the
output

-----Original Message-----
From: Jerry Johnson [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 27, 2007 2:12 PM
To: CF-Talk
Subject: Re: minus 30


Do you want 30 days, or 1 month? They are not the same thing (more than
half the time)

what does endate look like? a date object, or is it a YYYYMMDD string?

On 9/27/07, Orlini, Robert <[EMAIL PROTECTED]> wrote:
> One more thing Jerry
>
> How can I get one month prior to the end date? Suppose the endate is
9/1/2007...how can I subtract 30 days from that? That's where I got:
#DateAdd("d", -30, enddate)#.
>
> -----Original Message-----
> From: Jerry Johnson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 27, 2007 11:31 AM
> To: CF-Talk
> Subject: Re: minus 30
>
>
> <CFIF #get.enddate# eq #dateformat(dateAdd("m",-1,now()),"YYYYMMDD")#>
>
> (you need to do the dateAdd, and then do the dateFormat, and then do 
> the compare).
>
> (you can also look at dateCompare rather than the eq, if you want)
>
> On 9/27/07, Orlini, Robert <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > How can I subtract one month (30 days) from a value?
> >
> > The coding I have is:
> >
> > <CFIF #get.enddate# eq #dateformat(now(),"YYYYMMDD")#> Yes <cfelse> 
> > NO </CFIF>
> >
> > and they equal Yes all the time.
> >
> > Both these values check out OK and appear as: 20070927 But I need 
> > the #dateformat(now(),"YYYYMMDD")#> to go back one month I tried 
> > <CFSET expire = #dateformat(now(),"YYYYMMDD")#> and then 
> > #DateAdd("d", -30, expire)# but it displays as {ts '56852-03-30 
> > 00:00:00'} Thanks in advance.
> > Robert O.
> > HWW
> >
> >
> >
> >
>
>
>
> 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289723
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to