You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Mahesh Deshpande <ma...@yahoo.com> on 2004/10/13 07:39:15 UTC

Help needed with date format "mmmm d, yyyy" !!!

Hi Group,
When I am writing data to spearsheet, I am facing problem with date format.
I want dates to appear as -- September 12, 2003. 
So I am using follwing code to set this date format

HSSFCell cell = row.createCell(column);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("mmmm d, yyyy"));
cell.setCellValue(date); // date is passed as -- java.util.Date date
cell.setCellStyle(cellStyle); 
When data is written to spreadsheet, it gets written as numbers --- 37904, 38250, etc.

But when I use other date format - "d-mmm-yy" (such as 11-Jun-2004)
using 
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("d-mmm-yy"));
it works perfectly fine.

Can you help me. 
Regards,
Mahesh.
 

		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!