views:

31

answers:

1

Hi

I need to generate two dates in the format YYYY-MM-DD example : 2010-06-09

for the last 30 days so end date is today and start date is today - 30 days

can you help me generate those two dates in the previous format YYYY-MM-DD

thanks folks

+2  A: 

for the last 30 days so end date is today and start date is today - 30 days

The strtotime is real friend:

echo date('Y-m-d', strtotime('today - 30 days'));
Sarfraz