PHP date calculations: last day of the month

PHP’s date() function must be my favourite PHP function. You need never struggle with manipulating dates in PHP — if you need to use more than one line of code for working out a date, you probably just haven’t looked at the date function closely enough. This one’s from here; it works out the last day of the previous month. Yes, even when it’s a leap February.
echo date("t/m/Y", strtotime("last month"));

This entry was posted in PHP and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>