[suspicious - maybe spam] Re: [PHP] Re: Help with dates
| From: | Mattias Thorslund | Date: | Mon, 07 Mar 2005 03:34:50 +0000 |
| Subject: | [suspicious - maybe spam] Re: [PHP] Re: Help with dates | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-210131@lists.php.net to get a copy of this message | ||
M. Sokolewicz wrote:
well, you can simply use the unix timestamp, since the amount of days / seconds since 0 AD/BC will be a constant (it won't change, trust me), you can simply add it to that, and add a wrapper function to php's time(). You'll be working with VERY big numbers in that case, so you can also do it the other way around; store the amount of DAYS since 0 AD/BC till Jan 1st 1970, add time()/86400, and you'll have the amount of days since 0 AD/BC in an integer (or float, depending on how many days that really are). You'll just need to find that constant somewhere :)Can't be too hard to calculate it: 1970 * 365 + 1 day for each leap year. Note the rules for leap year, of course. /Mattias -- More views at http://www.thorslund.us