0
votes

when I try to get data from dbf file to Excel PowerQuery, using Visual Foxpro OLE DB provider all is ok except date field - I get 1899-12-30. The same result when I try to do that with C# + OLEDB. When I just open this dbf file with Excel, instead of date string I see symbols like that:Ü|% How to read/convert dbf date field correctly?

2
Excel has a tendency to corrupt FoxPro tables. Have you tried opening the table in FoxPro to make sure the date field is valid? - StoneGiant
This problem exists for all dbf files I have in application. I do not think all files are corrupted. And FoxPro app shows date in proper way. Unfortunately, I do not have FoxPro. - JustAlex

2 Answers

0
votes

Actually, the Dec 20, 1899 is basically an empty date is intentional. Going WAYY WAYYYY back, I can't remember the exact time I needed, but that was like a baseline date within Excel. When trying to read in dates from Excel, I would have to add the number of days between date() and date(1899,12,30) to get correct date. It should not be considered a garbage value.

0
votes

The problem was non standard dbf date field format - instead of 8 bytes it takes 4 bytes only (after analyzing with hex viewer). So, Visual FoxPro OLE DB provider could not interpret it correctly.