> Hello,
> For instance today is 05-01-2001 I would like to
> determan the previous 7 days from that date.  In VB
> Date - 7 = 04-24-2001  I would like this to work for
> any date using php.
> Here is what I have so far...
> $t = (date ("m-d-Y"));
> echo $t; // output 05-01-2001
> echo "<br>";
> $r = $t - 7;
> echo $r; //output -2
> but now $r returns -2
> How do I get $r to yesterdays date in this format.
> 04-30-2001

 see the php manual: (Function Reference / XV. Date and Time functions) 
a piece of description & examples about date() function:

$tomorrow  = mktime (0,0,0,date("m")  ,date("d")+1,date("Y"));
$lastmonth = mktime (0,0,0,date("m")-1,date("d"),  date("Y"));
$nextyear  = mktime (0,0,0,date("m"),  date("d"),  date("Y")+1);

date() with mktime() is more than perfect. After subtracting date parts with the help 
of date()  you pass them to mktime... 
and you can deal with its arguments as integers.(see ie: $tomorrow).


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to