Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Sun Jul 18, 2010 2:13 am |
|
|
Basically, the 'core' of what you need is there.
The reason the formulae there are limited to this century, is simply that they only use the last two digits of the year, and that the leap year calculator doesn't use the full formula. However the full formula is published later in the thread.
Now, there is an overall limitation, that these formulae can only cover 136 years, since past this, the number of seconds goes beyond an int32...
So, start with the formulae published.
Offset back by 100 years. So 1924, becomes '24', 2010, becomes '110' etc. The day of week calculator will need '19', instead of '20' as the century.
Modify the 'leap year' calculation to allow for the year 2000 (100 as an incoming year number).
The alternative is to switch to using full int16 year numbers, but offsetting will still be needed because of the 136 year limit, so you might as well stick with int8, and use 1900 as the origin.
Best Wishes
Potentially this will cover 1901 to 2035 inclusive |
|