incorrect date when opening a dbf (foxpro) file

When I open a dbf file (foxpro), date appears to be incorrect.

For example:

01/06/2019 17:05:03 becomes 02/06/2019 10:05:02 and

02/06/2019 21:27:33 becomes 03/06/2019 18:27:32

On both examples the first date/time is correct. I’ve tried to change date/format settings but I have not been able to correct the date.

Thanks!

SAMPLE FILES:

sample_rename_extension_to_dbf.xls (please change the extension to dbf first, this is the only way I could upload this sample file)

sample_file_correct_date.xlsx

Hi - I can confirm that the first screenshot looks the same. I have a MacOS, so the 2nd screenshot - I cannot find it under the preferences.

I did however installed LibreOffice onto Parallels (Win10) and both settings were the same. I opened the file under Win10 LO, and dates were same as what I repored above (i.e. there is no difference between MacOS and Win10).

I have tried to upload a dbf file but the extension is not supported. So I changed it to xls - please change the extension to dbf if you would like to try.

I’ve also added an xlsx version, which has the correct dates.

Thanks!

The numbers are different in xlsx and dbf. Change column format to decimal (not date) and you’ll see that the decimal numbers are not the same and the diff is also not a fixed value. Thus, whatever you change the format to, they will never fit (Please note: Dates are internally stored as decimal numbers, where the integer part is the number of the days since start of calculation (see @Hrbrgr second screenshot showing Date as the day “0”), while the decimal part represents the fraction of a day - Date formatting is only to representate this decimal number in a human readable format). This comment does not exclude the possibility of LibreOffice importing incorrect numbers (I got no other software enabled to read .dbf files and to compare these with LibreOffice’s import result)

Yes, I noticed the difference only recently - but cannot understand why there’s such difference.

There is a free tool called DBF Viewer Plus, which is great, and this is the tool I used for exporting DBF to xlsx. I know the date displayed by this tool is correct because it is inline with the data where it originates from.

So does it sound like a bug then?

So does it sound like a bug then?

Definitely. Please file it.

Filed - thanks.

The same happens if the .dbf file is connected against using Base instead of Calc. May it be that the stored date+time values are somehow timezone afflicted?

@erAck: From my understanding DBF file looks like to have a real date format in contrary to calc et.al storing dates as decimal numbers. If (!!!) that’s true, importing a dbf file would require some kind of interpretation of that date fomat. And regarding timezone afflicted: Thats why I wrote above in my comment “…the diff is also not a fixed value”. Since the diff isn’t a fixed value I’d conclude: The issue is not related to some timezone settings.

@repla:
What is the resulting bug number?

Edit: Nevermind, found it, tdf#125878

And fixed, thanks for the report.

Thank you for your support and for issuing a quick fix.

Have you ever checked what’s up with you?
Menu Tools>LibreOffice>General

Menu Tools>LibreOffice Calc>Calculate

If my answer did solve your problem, please click the big checkmark inside the circle image description to the left of this answer. It then indicates to the other participants that the question has been answered correctly.

With me Windows 10 Home; Version 1903; 64-Bit | LibreOffice, Version: 6.2.4.2 (x64).

Bug tdf#125878, fixed for master, 6.3.0 and probably 6.2.5