Bug 54744 - Java BC Dates don't seem to become AD dates when converted to Excel
Summary: Java BC Dates don't seem to become AD dates when converted to Excel
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.9-FINAL
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2013-03-22 17:47 UTC by Matthew Carey
Modified: 2016-04-08 17:47 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Carey 2013-03-22 17:47:13 UTC
Creating an BC Date using a new java.text.SimpleDateFormat("dd/MM/yyyy G") and getting Java to confirm that it is a BC date by getting it print as a string using the same SimpleDateFormat objext  then using cell.cellSetValue(Date) and inspect the resulting spreadsheet (Admittedly using libreoffice) it has changed to an AD date.
Comment 1 Matthew Carey 2013-03-22 17:48:53 UTC
There is a chance that this is a LibreOffice issue.
Comment 2 Mark B 2013-03-23 09:25:35 UTC
You might have a slight - well large - problem here. As far as I am aware, Excel is not able to handle dates prior to 1900AD without special add ins. Just what they are, I do not know and feel that you need to consult an Excel specialist - try one of the on-line forums for Excel users as a start - to discover this information.

Commonly, users who need to enter such dates keep them in a simple text format. This will only work if you do not need to perform date arithmetic using such values.
Comment 3 Mark B 2013-03-25 07:51:46 UTC
If you just wish to show the year - 1066 AD or 500 BC - then there is a format trick that I found. Take a look here - http://answers.microsoft.com/en-us/office/forum/office_2007-excel/using-bc-and-ad-years-in-an-excel-spreadsheet/24f7ec42-de34-4bd0-b284-292a1770b8f7
Comment 4 Matthew Carey 2013-03-25 10:26:48 UTC
Thanks, I can live with this as the customer wants reports on a database in excel format, they will have to put up with fields that contain remote dates being rendered as strings. But it useful to see the workaround suggested.
Comment 5 Dominik Stadler 2016-04-08 17:47:13 UTC
I dont think we will plan to put anything into poi directly, there seem to be workarounds possible if needed.