In comp.lang.pascal.borland message <1174484556.430345.236600@[EMAIL PROTECTED]
>, Wed, 21 Mar 2007 06:42:36, mljdth
<mljdtj@[EMAIL PROTECTED]
> posted:
>
>I'm trying to extract data from a file generated by an old Turbo
>Pascal program. (Not sure which version exactly)..
>Using a hex editor, I have determined that the dates are 2 bytes in
>length.. Some examples are:
>
>EA40 = 59968 = 7/1/06
>EB40 = 60224 = 7/2/06
>5E41 = 24129 = 10/25/06
>7241 = 29429 = 11/14/06
>I cannot determine how the dates are encoded.. Any suggestions?
Well, you use a non-standard encoding for dates; the standard calls for
YYYY-MM-DD, not FFF - those dates are really as below (in International
Standard 8601 notation, of course), with the next column being the
corresponding CMJD, Clearly, your Hex needs to be transposed, as in the
3rd column, which converts to the decimal in Column 4; Column 5 is
differences.
2006-07-01 53917 40EA 16618 37299
2006-07-02 53918 40EB 16619 37299
2006-10-15 54033 415E 16734 37299
2006-11-14 54053 4172 16754 37299
Clearly, therefore, your Hex represents a count from CMJD 37299 = 0
and that is 1960-12-31 - or a count from 1961 Jan 1 = 1. Check the
details.
That origin is not known to me; it's not in
<URL:http://www.merlyn.demon.co.uk/dayscale.htm#Zero>.
So : transpose your Hex (except that the order must be a viewing
artefact), convert to decimal (but that Hex is only representing a
Pascal integer or word), and you have a count of days. That can be
converted to Y M D with a function such as MJDtoYMD from
<URL:http://www.merlyn.demon.co.uk/programs/dateprox.pas>.
NOTE : if your values are integer, the system will fail after FF7F which
must be around 2054; if word, FFFF, 2144 - check those.
--
(c) John Stockton, Surrey, UK. ?@[EMAIL PROTECTED]
Turnpike v6.05
IE 6.
Web <URL:http://www.merlyn.demon.co.uk/>
- w. FAQish topics, links,
acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/>
- see
00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm
etc.


|