PDA

View Full Version : Is the best way to calculate last month (date)?


Tim Mousel
Mon 7th Jul '03, 8:05pm
Hi,

Is the best way to achieve this?


$LastMonth = date("F-Y", date("U") - date("t")*24*60*60 );

echo "$LastMonth";

Scott MacVicar
Mon 7th Jul '03, 8:57pm
strtotime("Last month");

will give you a nice unix timestamp which you can then put into date to give you a value.

Tim Mousel
Wed 9th Jul '03, 1:52pm
Thanks Scott.

Dean C
Fri 11th Jul '03, 11:20am
What a useful function :)