Return-Path: Delivered-To: apmail-poi-dev-archive@www.apache.org Received: (qmail 13612 invoked from network); 30 Aug 2010 11:39:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Aug 2010 11:39:47 -0000 Received: (qmail 18864 invoked by uid 500); 30 Aug 2010 11:39:46 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 18610 invoked by uid 500); 30 Aug 2010 11:39:43 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 18595 invoked by uid 99); 30 Aug 2010 11:39:42 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Aug 2010 11:39:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Aug 2010 11:39:25 +0000 Received: from thor.apache.org (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o7UBd3Tq006365 for ; Mon, 30 Aug 2010 11:39:03 GMT Received: (from daemon@localhost) by thor.apache.org (8.13.8+Sun/8.13.8/Submit) id o7UBd3c7006364; Mon, 30 Aug 2010 07:39:03 -0400 (EDT) Date: Mon, 30 Aug 2010 07:39:03 -0400 (EDT) From: bugzilla@apache.org To: dev@poi.apache.org Subject: DO NOT REPLY [Bug 49843] New: DateUtil.getJavaDate() fringe cases X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: POI Overall X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: i8c.alex@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=49843 Summary: DateUtil.getJavaDate() fringe cases Product: POI Version: 3.6-dev Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: POI Overall AssignedTo: dev@poi.apache.org ReportedBy: i8c.alex@gmail.com The DateUtil.getJavaDate() service uses a calendar with the local timezone to transform an excel double into a java.util.Date. Consider however the following example: A user fills in "00:00" in a cell and formats it as a time. The user then "drags" the bottom right corner downwards until row "27" is reached. This row will read "02:00:00". Because excel starts counting on the 31st of december 1899, rows 25, 26 and 27 are times expressed on the 1st of january 1900. Suppose that the system default for timezone is "Europe/Paris". If i then wish to format that date with SimpleDateFormat with timezone set to the same default, everything works fine: 1899-12-31 22:00:00 CET 1899-12-31 23:00:00 CET 1900-01-01 00:00:00 CET 1900-01-01 01:00:00 CET 1900-01-01 02:00:00 CET However if we set the timezone of the simpledateformat to "UTC", we get the following: 1899-12-31 22:00:00 UTC 1899-12-31 23:00:00 UTC 1900-01-01 00:50:39 UTC 1900-01-01 01:50:39 UTC If we set the system timezone to UTC (so the calendar uses UTC) then everything works again. Also note the results for default timezone "Europe/Brussels" with formatting for "UTC": 1899-12-31 22:00:00 UTC 1900-01-01 00:00:00 UTC 1900-01-01 01:00:00 UTC 1900-01-01 02:00:00 UTC Can we get an overloaded getJavaDate() call where we can define the timezone for the calendar in question? The attachment is an example xlsx with java code. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org