note 32093 deleted from function.date by philip

From: Date: Sat, 02 Aug 2003 15:31:15 +0000
Subject: note 32093 deleted from function.date by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53207@lists.php.net to get a copy of this message
Note Submitter: php.net@thedrewerys.com ---- To get the number of days in the current month: $daysInMonth = date( "j", mktime(0, 0, 0, date("n",time()) + 1, 1, date("Y",time())) - 1 ); This can also be used as a function: function getDaysInMonth($month=null,$year=null) { if ($month==null) { $month = date("n",time()); } if ($year=null) { $year = date("Y",time()); } $dim = date( "j", mktime(0, 0, 0, $month + 1, 1, $year) - 1 ); return $dim; } This will let you call the function to get the current months last day, or you can pass in a month and year to get the corresponding last day.

« previous php.notes (#53207) next »