0

Selecting a date on the Calender which format is:

YYYY-MM-DD

for instance:

2011-11-01

Then I want to display the yesterday's date (i.e 2011-09-30) after clicking "one day before" button.

Is there anyone who know how to do it in pure php?

Thanks in advance.

Ofir Baruch
  • 10,323
  • 2
  • 26
  • 39
Acubi
  • 2,793
  • 11
  • 41
  • 54
  • `date( 'Y-m-d', strtotime( '2011-11-01 -1 day' ) )` – JJJ Oct 06 '11 at 15:20
  • Also, possible duplicate of [PHP: How can I find out the date of the day before a date?](http://stackoverflow.com/questions/781949/php-how-can-i-find-out-the-date-of-the-day-before-a-date) – JJJ Oct 06 '11 at 15:22

1 Answers1

3

Well it would require a page load (if you are not using any javascript ajax functionality)

To get yesterday's date you do:

$date = date('Y-m-d', strtotime('-1 day'));
Naftali
  • 144,921
  • 39
  • 244
  • 303