我的任务是从一些奇怪的旧系统中读取一些数据。
该系统包含许多日期,但它们的格式都很奇怪。它们是范围从大约 55,000
到 80,000
的整数。
我确实知道两个日期:
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.
在我看来,这些整数是自 1800 年 12 月 28 日以来经过的天数。但我认为这是一个开始日历的非常奇怪的日期。闰年可能会发生一些事情,而这会在以后引起问题。
有谁认识这个日历吗?谁能告诉我将这些整数转换为人类可读日期的正确方法是什么?
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 approximately 55,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 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?
发布评论
评论(6)
可能是歌乐。我正在使用类似的旧数据库转换为 SQL,它发现文件 (*.dat) 是 clarion
It could be Clarion. I'm working with similar old database conversion to SQL, and it figured out files (*.dat) were clarion
我正在使用一个在儒略历中表示公历日期的系统,如果您想将儒略日期转换为公历,您只需将天数添加到 1800 年 12 月 28 日。
在 SQL Server 中:
例如。抱歉,我不会说英语。您系统中的基准日期是 1800 年 12 月 28 日。
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 :
by example. Sorry, I don't speak english. The base date in your system is December 28 1800.
对我来说听起来像是一个定制系统,但一个相当奇怪的系统:)
一种始终有效的转换方法是使用某种 date_add() 函数 - 你不指定你正在使用哪种语言,但大多数现代语言应该有一种在日期中添加几天的方法。
关于闰年,如果这 2 个日期正确,那么您应该不会有问题,至少有 1 个闰年 betweek 1960 和 1969 :) 绝对值得检查一些最近的日期以确保这一点。
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.
这并不奇怪。例如,Javacards 上的日期是从 1986-02-04 开始通过类似方案计算的: http://forums.sun.com/thread.jspa?threadID=5421557&messageID=10894720#10894720
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
是的,它是 Clarion 数据文件。使用
Edit1.Text := datetostr(encodedate(1800,12,28) );
Yes it is Clarion Data files. Use
Edit1.Text := datetostr(encodedate(1800,12,28) );
函数convertNumberToDate($number)
函数convertDateToNumber($date)
function convertNumberToDate($number)
function convertDateToNumber($date)