You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Сергій Карпенко <be...@ukr.net> on 2008/06/05 12:41:03 UTC

HSSF time zone extracting problems

Hi. I have a problem    
    
I have a code    
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");    
...    
case HSSFCell.CELL_TYPE_NUMERIC: {    
double d = cell.getNumericCellValue();    
if (isCellDateFormatted(cell)) {    
Date date = HSSFDateUtil.getJavaDate(d);    
String cellText = this.DATE_FORMAT.format(date);    
}    
break;    
}    
    
For example,    
I have a cells with date 10.02.2005 (38627 as didgit) and 2.2.05 (38385) on the same sheet.    
    
Test results:    
Celltext values on different systems    
Excel Windows Linux    
10.02.2005 (38627) | 2005-10-02 00:00:00.000+0300 | 2005-10-02 00:00:00.000+0000 and 2005-10-02 00:00:00.000+0300    
2.2.05 (38385) | 2005-02-02 00:00:00.000+0200 | 2005-02-02 00:00:00.000+0000 and 2005-02-02 00:00:00.000+0300    
    
So, on Windows we have a different values of time zone per sheet, on Linux we have a single value, and it depends from local settings.    
    
Is it possible to describe and fix?    
May be that this is not poi but java.text.SimpleDateFormat problem?