Help with Turbo Basic date convertion for Y2k- Plse help !!! 
Author Message
 Help with Turbo Basic date convertion for Y2k- Plse help !!!

Hi

I hope somebody can help me. I need to convert data from a non Y2K
compliant system, that was written in Turbo Basic,  to a new system.
The old data files contains date fields that was created by some kind
of  Turbo Basic function and saved into 4 bytes as a long.

I say that it must have been a function because the old system in not
very sophisticated and I dont think that the original programmer was
so smart to work out a formula to save the data into a long.

By comparing some of the output reports from the old system, I have
been able to determine some formula how the dates was stored. BUT, not
all dates work like this I will show you some examples.

For instance, the date 1911/11/11 is stored in a YYMMDD format as
x8003D947  To convert it back to the numerical value of 111111
(century omitted), you need to switch the bytes order (because of the
way a long is stored) to x47D90380, then subtract x47000000 and
devide the result by x80 (128). THIS HOWEVER, DOES NOT WORK FOR ALL
DATES.

The date 1910/01/01 is stored as x8082C347 , 1910/01/02 as
x0083C347 and 1910/01/31 as x8091C347. Thus the increment here is
x80 (Dont forget to switch the bytes when you try to get a numeric
value)

But, the increment is not always the same.  For example, the date
1999/01/01 is stored as x50B97149  and 1999/01/31 as x30BB7149
thus (x4971BB30 x4971B950)/x10= 30 in this case the increment
is only x10.

Here are some other dates :

1990/01/01=x50C05B49              Increment 16 (x10)
1990/01/31=x30C25B49

1980/01/01=x50C74549              Increment 16 (x10)
1980/01/31=x30C94549
1980/02/01=x90CD4549

1970/01/01=x50EC2A49      Increment 16 (x10)
1970/01/31=x30EE2A49
1970/02/01=x90F22A49

1960/01/01=x50821249              Increment 16 (x10)
1960/01/31=x30841249
1960/02/01=x90881249

1950/01/01=xA030F448      Increment 32 (x20)
1950/01/31=x6034F448
1950/02/01=x203DF448

1940/01/01=xA05CC348      Increment 32 (x20)
1940/01/31=x6060C348
1940/02/01=x2069C348

1930/01/01=xA0889248              Increment 32 (x20)
1930/01/31=x608C9248
1930/02/01=x20959248

1920/01/01=x40694348              Increment 64 (x40)
1920/01/31=xC0704348
1920/02/01=x40824348

1919/01/01=x40A53948              Increment 64 (x40)

1911/01/01=x800AD747              Increment 128 (x80)
1911/01/31=x8019D747

Can someone help me with a C or C++ routine to convert this long back
to a date format of YYMMDD ? Perhaps you have done this type of
convertion plse let me know.

Perhaps you know how the bit manipulation was done.

All help will be appreciated.

Thanks from South Africa

Fanus Johnson

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 01 May 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help with Date Conversion Y2k

2. Help Plse on Error (513): Internal Error 13

3. Problem with hide/show manu, plse help!

4. BASIC VS. TURBO-BASIC

5. Please help Visual Basic Programer with simple read/write text file routine---Real Basic 2.1

6. DAT to DBF convertion, please help !

7. Beginner needs help with Clipper->Windows 3.1 convertion

8. chm2web - HTML Help convertion utility

9. Help! Utter newbie needs help with basic code

10. Date Convertion

11. help! f90.help help help help

12. Interfacing Turbo Prolog to Turbo Pascal of Turbo C

 

 
Powered by phpBB® Forum Software