Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Borland > Re: Packed Date...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 1010 of 1118
Post > Topic >>

Re: Packed Date problem

by Dr J R Stockton <jrs@[EMAIL PROTECTED] > Mar 21, 2007 at 11:49 PM

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.
 




 6 Posts in Topic:
Packed Date problem
"mljdth" <ml  2007-03-21 06:42:36 
Re: Packed Date problem
Marco van de Voort <ma  2007-03-21 14:35:04 
Re: Packed Date problem
"Jochen" <jo  2007-03-21 16:04:25 
Re: Packed Date problem
"Jochen" <jo  2007-03-21 16:13:00 
Re: Packed Date problem
"mljdth" <ml  2007-03-21 14:53:38 
Re: Packed Date problem
Dr J R Stockton <jrs@[  2007-03-21 23:49:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 0:27:40 CDT 2008.