Summary: | [PATCH] Use the calendar's timezone in HSSFCell.setCellValue(Calendar) | ||
---|---|---|---|
Product: | POI | Reporter: | Hack Kampbjorn <hak> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 3.0-dev | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other | ||
Attachments: | Patch HSSFCell.setCellValue(Calendar) to use the calendar's timezone |
Description
Hack Kampbjorn
2006-02-14 14:32:45 UTC
Created attachment 17688 [details]
Patch HSSFCell.setCellValue(Calendar) to use the calendar's timezone
This patch changes HSSFCell.setCellValue(Calendar) to use the Calendar's
timezone so both 20:00-03:00 and 20:00+03:00 are reported as 20:00.
This bug is annoying when POI is used on the server side, and there are clients using different time zones. Currently, there is a workaround, but it would be simple to fix that bug. Here is the workaround: long time=date.getTime(); TimeZone defaultTZ=TimeZone.getDefault(); TimeZone usedTZ= [get the timezone to use here] int offset=usedTZ.getOffset(time) - defaultTZ.getOffset(time); if (offset!=0){ date=new Date(time+offset); } cell.setCellValue(date); Patch updated to match current HSSFDateUtils structure, and applied to svn trunk |