pro-rated date
| From: | Paul Chvostek | Date: | Mon, 17 Feb 2003 21:03:37 +0000 |
| Subject: | pro-rated date | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135895@lists.php.net to get a copy of this message | ||
Anybody have a quick way of determining the number of days remaining in
the current month?
I'm currently using:
$nextmonth = strftime("%Y-%m-01",strtotime("+1 month"))
$monthdays = strftime("%d",strtotime($nextmonth)-86400);
$daysleft = $monthdays - strftime("%d",time());
I can obviously compact things into a single line, but it's enormous and
offends my sense of esthetics. I was hoping I might be able to feed
something funky like "first day of next month" to strtotime, but the gnu
date input format isn't quite that flexible.
Any advice? Is there an *elegant* way of doing this?
--
Paul Chvostek <paul@it.ca>
Operations / Abuse / Whatever
it.canada, hosting and development http://www.it.ca/