Decrementing Days in PHP

Suppose I have a date coming in, "2009-01-01", what is the correct ways to decrement the date so that it will be just one day smaller.

 #

Here is another way out for decrementing days
$date = strtotime("-1 day", strtotime("2009-01-01"));
echo date("Y-m-d", $date);

 
 #

//let's
$today="2009-01-01";
//then
$previousday=strftime("%Y-%m-%d", strtotime("$today -1 day"));

 

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks