Hi,
Tuesday, February 18, 2003, 7:03:37 AM, you wrote:
PC> Anybody have a quick way of determining the number of days remaining in
PC> the current month?
PC> I'm currently using:
PC> $nextmonth = strftime("%Y-%m-01",strtotime("+1 month"))
PC> $monthdays = strftime("%d",strtotime($nextmonth)-86400);
PC> $daysleft = $monthdays - strftime("%d",time());
PC> I can obviously compact things into a single line, but it's enormous and
PC> offends my sense of esthetics. I was hoping I might be able to feed
PC> something funky like "first day of next month" to strtotime, but the gnu
PC> date input format isn't quite that flexible.
PC> Any advice? Is there an *elegant* way of doing this?
PC> --
PC> Paul Chvostek <[EMAIL PROTECTED]>
PC> Operations / Abuse / Whatever
PC> it.canada, hosting and development http://www.it.ca/
This might get what you want, but to be accurate you will have to decide what to
do with the odd hours mins left over
$days = (strtotime("+1 month") - (date("d")* 86400) - time()) / 86400;
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php