10/2/2014 - 10:31 PM

How can I take todays date, Now(), and find yesterday's date? 

I am setting up an automatic file retrieval from an ftp site. A new file is 
placed there every day, and part of the filename is the previous day's date in 
'mmddyyyy' format. Every day I want to pull the most recent file, which would 
be named using the previous day's (yesterday's) date. 

Example: Today is 06182004, so the newest file would be File06172004.txt

Is there simple way to do this? It seems so simple, but I can't find a way that 
works consistently. None of the Date functions in CF seem to cover this. I 
searched the forum for a solution first, and it looks like PHP has something 
called "strtstrotime" that will work for this, so I suspect CF does too, I just 
haven't found it. 

<cfset today = Now()>
<cfset yesterday = CreateDate(Year(Now()),Month(Now()),Day(Now()-1))>

today: #today#<br>
yesterday: #yesterday#