note 18643 added to ref.datetime
| From: | php-contrib at i-ps dot nospam dot net | Date: | Wed, 30 Jan 2002 11:07:38 +0000 |
| Subject: | note 18643 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26027@lists.php.net to get a copy of this message | ||
Someone may find this info of some use:
Rules for calculating a leap year:
1) If the year divides by 4, it is a leap year (1988, 1992, 1996 are leap years)
2) Unless it divides by 100, in which case it isn't (1900 divides by 4, but was not a leap
year)
3) Unless it divides by 400, in which case it is actually a leap year afterall (So 2000 was a leap
year).
In practical terms, to work out the number of days in X years, multiply X by 365.2425, rounding DOWN
to the last whole number, should give you the number of days.
The result will never be more than one whole day inaccurate, as opposed to multiplying by 365,
which, over more years, will create a larger and larger deficit.
--
http://www.php.net/manual/en/ref.datetime.php
http://master.php.net/manage/user-notes.php?action=edit+18643
http://master.php.net/manage/user-notes.php?action=delete+18643
http://master.php.net/manage/user-notes.php?action=reject+18643