note 88367 deleted from function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Wed, 11 Feb 2009 16:47:18 +0000 |
| Subject: | note 88367 deleted from function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150496@lists.php.net to get a copy of this message | ||
Note Submitter: Zoe Blade
----
Just in case anyone else might find these useful, you can work out the number of days left in the
month or year like this:
<?php
$daysLeftInMonth = ceil((strtotime(date('Y-m-01', strtotime('next month'))) -
time()) / 86400);
$daysLeftInYear = ceil((strtotime(date('Y-01-01', strtotime('next year'))) -
time()) / 86400);
?>
Note these include the current day. floor() will exclude the current day.