Got this function...
I wanna remove 90 days from todays date, giving a final date, in the same 
format as the original, that counts back 90 days...
I'm listing dates on a reporting tool, and I've been asked to only show 
info that we recieved in the last 90 days...
Anyhoo...
I believe I can minus 10 days from $day by having...
        $timestamp = mktime (0,0,0,$month,$day-10,$year);
But is there an easy was to calculate 90 days from the timestamp...
My worry is that I need to calculate how many days in a month, and then 
work out hown many days to remove from that month... etc..
it's all getting far more complicated that it needs to be, and I can't 
believe I'm the first person to try and do this...
My code is below, and if anyone would like to offer advse, I welcome it...

=======================
$today = date("Y-m-d");
function minus90($calc){
   $year = substr($today, 0, 4);
   $month = substr($today, 5, -3);
   $day = substr($today, 8, 10);
   $timestamp = mktime (0,0,0,$month,$day,$year);
   return strftime ("%Y-%m-%d", $timestamp);
}
$archive_date = minus90($today);


echo $archive_date;
==========================

*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************

Reply via email to