set start and end date for last 30 days ending today with php
Pergunta
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
Solução
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'));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow