note 54250 added to function.strtotime

From: Date: Tue, 28 Jun 2005 12:14:21 +0000
Subject: note 54250 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-91087@lists.php.net to get a copy of this message
This is an easy way to calculate the number of months between 2 dates (including the months in which the dates are themselves). <? $startDate = mktime(0,0,0, 6, 15, 2005); $stopDate = mktime(0,0,0, 10, 8, 2006); $nrmonths = ((idate('Y', $stopDate) * 12) + idate('m', $stopDate)) - ((idate('Y', $startDate) * 12) + idate('m', $startDate)); ?> Results in $nrmonths = 16. ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54250 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54250&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54250&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54250&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54250&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54250&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54250&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54250&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#91087) next »