Calling mktime before 1/1/1960
Moderator: General Moderators
Calling mktime before 1/1/1960
Hi again:
I need to calculate the number of minutes between the current time and
January 1, 1601. Can someone suggest an optimal way to do this in PHP? I can't do a mktime on the date 1/1/1601 because it complains it can't go back further than 1/1/1970. Thanks in advance
I need to calculate the number of minutes between the current time and
January 1, 1601. Can someone suggest an optimal way to do this in PHP? I can't do a mktime on the date 1/1/1601 because it complains it can't go back further than 1/1/1970. Thanks in advance
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
mins in hour = 60
mins in day = 60*24
mins in year = 60*24*365
mins in leap year = 60*24*366
years since 1601 = 403
leap years = 100
days since 1 jan = ...
Etc, and just work your way back. Im sure you can make a function so it will tell you for any date you imput, its just a process of working it out.
mins in day = 60*24
mins in year = 60*24*365
mins in leap year = 60*24*366
years since 1601 = 403
leap years = 100
days since 1 jan = ...
Etc, and just work your way back. Im sure you can make a function so it will tell you for any date you imput, its just a process of working it out.
-
crookedgoomba
- Forum Newbie
- Posts: 4
- Joined: Fri May 28, 2004 2:38 am
Ya, leap years every 4 years, except when the year is divisible by 100, except when the year is divisible by 400 (then it's a leap year as well).crookedgoomba wrote:divide the number of years since 1601 by 4... considering there are leap years every 4 years
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Sorry to get technical (and I'm sure this is over the top for what you want) but if you want to be really accurate you have to take into account leap seconds as well.
Leap seconds occur because the effect of the tides on the Earth's rotation slows it down, putting our day/night timings out slightly.
There is much more information here.
Leap seconds occur because the effect of the tides on the Earth's rotation slows it down, putting our day/night timings out slightly.
There is much more information here.
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England