You can use the DateAdd function and specify negative numbers to subtract
dates. i.e. #DateAdd("d", -1, "03/21/2000")# will give you 03/20/2000. If
you're looking for a list of dates from your new date to now(), you can try
something like this:
<cfset newDate = DateAdd("d", -1, "03/21/2000")>
<cfset numDays = Abs(DateDiff("d", newDate, now()))>
<cfloop from="1" to="#numDays#" index="loopindex">
<cfoutput>
#DateFormat(DateAdd("d", loopindex, newDate), "mm/dd/yyyy")#<br>
</cfoutput>
</cfloop>
or if you want a true "list" of them......
<cfset newDate = DateAdd("d", -1, "03/21/2000")>
<cfset numDays = Abs(DateDiff("d", newDate, now()))>
<cfloop from="1" to="#numDays#" index="loopindex">
<cfif IsDefined("myList")>
<cfset myList = ListAppend(myList, DateFormat(DateAdd("d", loopindex,
newDate), "mm/dd/yyyy"))>
<cfelse>
<cfset myList = DateFormat(DateAdd("d", loopindex, newDate),
"mm/dd/yyyy")>
</cfif>
</cfloop>
HTH
Josh Black
----- Original Message -----
From: "Pablo Nevares" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 29, 2000 5:47 PM
Subject: Subtracting one day from a date
> I'm almost positive this is something that should be easy to do, but the
> function's been eluding me for a while. =) I've got a date that I'm
> receiving from a query to a database, and I'm taking the earliest date
from
> it.
>
> My problem is how to subtract one from that date, and then output a list
> from the new date to Now(). It's in mm/dd/yyyy format, so if I have
> 03/21/2000 from the database I want 03/20/2000 to Now().
>
> Be easy on me, and thanks. =)
>
> Pablo Nevares
> Information Technology
> Hendricks & Partners
> [EMAIL PROTECTED]
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.