I am writing a class to process FoxPro .dbf files, all has been going well, but I have recently hit a snag. I'm trying to convert FoxPro's DateTime field (T) to a System.DateTime. FoxPro's field is 2 32bit integers: one stores the date, the other stores the time, stored in reverse byte order. (2f 4a 12 9a== 9a 12 4a 2f)
Easy... here's the hard part. The date integer stores the number of days from 1/1/4712BC (yes... BC). The time integer stores the number of milliseconds from 00:00:00.
Processing the time was easy ( DateTime.AddMilliseconds() ). Processing the date, is not.
Is there anyone who can lend a hand and help me process this date?
The date integer: 2453809 should become 20/04/2006
If only it were that simple... the tables in the database rely on some .prg files that were compiled into the foxpro application, meaning I can't access the data unless I'm accessing it through the application that was written. Considering this is a 3rd party addon for the application, I don't have such luxuries.
I'm reading the dbf files using a FileStream and BinaryReader combo. Using the following website as my reference:
Kalpesh wrote: > BTW, how are you reading the dbf files? > I suppose, it will be better to read dbf files using oledb provider > which supports reading foxpro files