Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get previous month date range

I need help getting the previous months full date range in the following format: Y-m-d

I have successfully been able to get "this" months full date range but not the "previous" months full date range.

Any help is greatly appreciated!

like image 508
three3 Avatar asked Jan 01 '12 18:01

three3


1 Answers

This gets the job done correctly:

echo date('Y-m-01 - Y-m-t', strtotime('previous month'));

Here is the proof: http://ideone.com/L82ZW

like image 116
Tadeck Avatar answered Oct 14 '22 04:10

Tadeck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!