Seth Willits wrote:

2) Have a date string representing the first of the month and manipulate it to be the last day of the previous month.

You can use mktime() for this. To get the last day of a given month, just give the parameters for the "zeroth" day of the next month. For example, to get the date for the end of $month:


$month = 4;
$year = 2003;
$endofmonth = date('m/d/y',mktime(12,0,0,$month+1,0,$year));

$endofmonth is now the last day of the April for 2003 in MM/DD/YY format.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to