note 88367 modified in function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Wed, 21 Jan 2009 21:38:14 +0000 |
| Subject: | note 88367 modified in function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149632@lists.php.net to get a copy of this message | ||
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.
--was--
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:
$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.
http://php.net/manual/en/function.strtotime.php