[jira] [Commented] (OFBIZ-5608) Dates Displaying Incorrectly With Negative Offest Timezones.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-5608) Dates Displaying Incorrectly With Negative Offest Timezones.

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-5608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13978016#comment-13978016 ]

Rupert Howell commented on OFBIZ-5608:
--------------------------------------

That comment directly disagrees with the javadocs.
From the java docs for java.sql.Date which is a subclass of java.util.Date and what is pulled back from the DB and converted to a java.util.Date then formatted.

To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated.
http://docs.oracle.com/javase/7/docs/api/java/sql/Date.html

Which is EXACTLY what I am seeing. Any negative offset applied moves the date back a day because as far as the formatter is concerned its midnight and needs to be changed to 11pm the previous night.

                } else if (retVal instanceof java.sql.Date) {
                    DateFormat df = UtilDateTime.toDateFormat(UtilDateTime.DATE_FORMAT, timeZone, null);
                    return df.format((java.util.Date) retVal);



> Dates Displaying Incorrectly With Negative Offest Timezones.
> ------------------------------------------------------------
>
>                 Key: OFBIZ-5608
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5608
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ALL COMPONENTS
>    Affects Versions: SVN trunk, Release Branch 12.04, Release Branch 13.07
>            Reporter: Rupert Howell
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: ObjectTypeTests.patch, dates.patch, dates_1589040.patch
>
>
> Dates are displaying incorrectly when negative offset (relative to UTC) are applied by the users settings.



--
This message was sent by Atlassian JIRA
(v6.2#6252)