문제

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

도움이 되었습니까?

해결책

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'));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top