Hi All
Im using php date function to pull results out of a mysql db,
<?
$day = date('d')-1;
$month = date('m');
$year = date('Y');
echo $day . $month . $year;
?>
Ive been using the code above to pull records from the db which were created the day before, Now ive been using this code for 2 weeks without a problem.
The problem lies in the date('d')-1, today being the 1/1/2006, d-1 = 0 d0h..
Now im thinking of using a statement as in.
if $day == 1;
{
$month = date('m')-1;
}
etc..
but im sure there a better way to do this than to write some long code for an easy task.
can anyone help me out ?