What calendar appears to count days since December 28, 1800?
I have been tasked to read in some data from some weird old system.
The system contains many dates but they are all oddly formatted. They are integer numbers ranging from approximately55,000
to 80,000
.
I know two dates for certain:
58,112 equals February 5, 1960 (originally written as Feb 2,1960 [*])
61,439 equals March 16, 1969
[*] This typo explains some of the comments initially challenging the
leap-year awareness of the calendar.
It appears to me that those integer numbers are the number of days elapsed since December 28, 1800. But I think that's a very strange date to start a calendar on. There is probably going something on with leap 开发者_Go百科years and what-not that is going to cause problems later on.
Does anyone recognise this calendar? Can anyone tell me what the proper way is to convert those integers to human readable dates?
It could be Clarion. I'm working with similar old database conversion to SQL, and it figured out files (*.dat) were clarion
I'm working with a system representing gregorian dates in julian calendar, if you want to convert a julian date to gregorian, you only need to add the quantity days to December 28 1800.
In SQL Server :
SELECT DATEADD(day, 58112, '18001228')
by example. Sorry, I don't speak english. The base date in your system is December 28 1800.
sounds like a bespoke system to me, but a rather strange one :)
one way to convert that will always work is use some sort of date_add() function - you don't specify which language you're using but most modern languages should have a way to add a bunch of days to a date.
regarding leap years, if those 2 dates are correct then you shouldn't have a problem, there was definitely at least 1 leap year betweek 1960 and 1969 :) it's definitely worth checking a few more recent dates just to make sure though.
It is not so strange. For example, date on Javacards is calculated by similiar scheme starting from 1986-02-04: http://forums.sun.com/thread.jspa?threadID=5421557&messageID=10894720#10894720
Yes it is Clarion Data files. Use Edit1.Text := datetostr(encodedate(1800,12,28) );
function convertNumberToDate($number)
enter code here
$dateZero = strtotime('1800-12-28');
$string = "+$number day";
return date('Y-m-d', strtotime($string, $dateZero));
enter code here
function convertDateToNumber($date)
enter code here
$dateZero = strtotime('1800-12-28');
$day = 86400;
$unix = strtotime($date);
$sub = $unix-$dateZero;
$result = $sub/$day;
return round($result,0);
enter code here
精彩评论