Page 1 of 1

How to get the 31st Decemeber while your are in 1st Jan?

Posted: Thu Jun 19, 2003 7:59 am
by rashed
Hi

Is there any function to get the previous date?
regards

Posted: Thu Jun 19, 2003 8:03 am
by twigletmac
If you're using timestamps you can easily go back a day:

Code: Select all

$today = mktime(); 
$yesterday = $today - (24*60*60); 
echo 'Yesterday was: '.date('d/m/Y', $yesterday);
Mac

Posted: Thu Jun 19, 2003 8:08 am
by rashed
Thank you vey much Mac,
What i did was
if(checkdate ( 12, 31,date("Y")-1 ))
{
//processing
}
But you are genius

Posted: Thu Jun 19, 2003 8:27 am
by rashed
The simple code to back-up the previous year's data at the begining of the year. ->
if (!strcmp(date('d/m/Y', $yesterday),"31/12/".(date("Y")-1)))
bk_up();