Re: Months since the Epoch
| From: | George Patterson | Date: | Sat, 28 Oct 2000 10:28:55 +0000 |
| Subject: | Re: Months since the Epoch | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22432@lists.php.net to get a copy of this message | ||
Michael Conley wrote:
>
> I need to store the number of months that have passed since the Epoch. Has
> anybody already written this type of code?
A simple solution...
months from epoch="seconds from epoch" /60/60/24/365.25*12
Epoch was currently 972,728,263...
972,728,263/60=16,212,138.72
16,212,138/60=270,202.30
270,202/24=11,258.43
11,258/365.25=30.82 years #allows for the leap years..
31*12=369.89 months since epoch
The above figures are accurate to the second decimal point. It doesn't
allow for leap seconds but should be close enough for you purposes.
Regards George Patterson
--
george@laopdr.com
Network Administrator
Planet Online
Vientiane, Lao PDR