poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lcai <larry_xi...@hotmail.com>
Subject How dose POI [h]:mm:ss dataformat work?
Date Tue, 29 Apr 2008 17:42:42 GMT

I was trying to read some data like "27:10:11" from a file and put into a
cell, I set the cell type to HSSFCell.CELL_TYPE_NUMERIC and cell style to
[h]:mm:ss But it didn't work, in the Excel I got "613683:10:11".

code:

HSSFCellStyle style = wb.createCellStyle();
style.setDataFormat(HSSFDataFormat.getBuiltinFormat("[h]:mm:ss"));

SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
Date date = df.parse(value);

cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
cell.setCellValue(date);
cell.setCellStyle(style);

any suggestion?

thanks
-- 
View this message in context: http://www.nabble.com/How-dose-POI--h-%3Amm%3Ass-dataformat-work--tp16966115p16966115.html
Sent from the POI - User mailing list archive at Nabble.com.


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


Mime
View raw message