You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Suchitra Varma <sv...@flagstar.com> on 2010/02/08 22:40:17 UTC

Regarding apache POI date formatting

Hi,

I have an issue with the apache POI date formatting when I execute my 
application in the Unix environment. We have windows environment locally and 
then we promote to a testing environment which is Unix. I know the code that I 
wrote is correct because in my local my formatting works fine, I am trying to 
format the date as mm/dd/yyyy hh:mm:ss AM/PM. But in the unix environment, this 
does not happen. In Unix the formatting always is set to yyyy-mm-dd for the 
date columns.

I am using the following to SimpleDateFormat to parse the date in String format 
to a Date Format:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");

Then I set the excel style using HSSFCellStyle. Here I say the following:

HSSFCellStyle cellStyle = wb.createCellStyle();
        cellStyle.setDataFormat(
            createHelper.createDataFormat().getFormat("m/d/yy h:mm"));

Now I set this style for the cells that requires the Date format.

As I said earlier all this works in Windows but seems to take no effect when 
run in Unix.

Has anyone come across this issue earlier.

Thanks and Best Regards
Suchitra


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org