[suspicious - maybe spam] [suspicious - maybe spam] Re: Help with dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check out:
http://pear.php.net/package/Date

According to the description, it lets you compare dates that date pre 1970 and post 2038.

/Mattias

(If I could only get off ezmlm's "suspicious user list". I think there isn't much I can do, it's my ISP rejecting some PHP list postings.)

Kevin wrote:

Greetings Mr Mattias,

I wish it was so simple. Because the dates that may need calculating can be
before 1970.

THis function I have.. and it's semi-working, but I've noticed
irregularities during the conversion.

Thanks for your suggestion!!

Yours,

Kevin
"Mattias Thorslund" <mattias@xxxxxxxxxxx> wrote in message
news:422BCBDA.1090309@xxxxxxxxxxxxxx


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






-- More views at http://www.thorslund.us

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux