note 92485 added to function.date

From: Date: Mon, 27 Jul 2009 01:06:52 +0000
Subject: note 92485 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-158754@lists.php.net to get a copy of this message
@seanj : Your logic isn't quite right. A year is a leap year if it's divisible by 4 unless it's also divisible by 100 in which case it needs to be divisible by 400 to be a leap year. 1900: not a leap year 2000: a leap year 2100: not a leap year 2200: not a leap year 2300: not a leap year 2400: a leap year The full logic if not using the date function would be something like this: function is_leap($year) { return ($year%400 == 0) || ($year%4 == 0 && $year%100 != 0); } (I'm not sure why a default of 2004 was included in the previous examples as that makes no sense at all to me.) ---- Server IP: 64.71.164.2 Probable Submitter: 207.224.40.76 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/92485 Del: integrated -- https://master.php.net/note/delete/92485/integrated Del: useless -- https://master.php.net/note/delete/92485/useless Del: bad code -- https://master.php.net/note/delete/92485/bad+code Del: spam -- https://master.php.net/note/delete/92485/spam Del: non-english -- https://master.php.net/note/delete/92485/non-english Del: in docs -- https://master.php.net/note/delete/92485/in+docs Del: other reasons-- https://master.php.net/note/delete/92485 Reject -- https://master.php.net/note/reject/92485 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158754) next »