db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4621) Invalid conversion from Timestamp to String when calling setTimestamp() with Calendar
Date Wed, 07 Jul 2010 16:02:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12885970#action_12885970
] 

Mamta A. Satoor commented on DERBY-4621:
----------------------------------------

Will work on backporting this to 10.5

> Invalid conversion from Timestamp to String when calling setTimestamp() with Calendar
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-4621
>                 URL: https://issues.apache.org/jira/browse/DERBY-4621
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Mamta A. Satoor
>             Fix For: 10.6.1.0
>
>         Attachments: derby-4621.diff, TimestampToVarchar.java
>
>
> If you set a VARCHAR parameter with setTimestamp(), the string will be formatted differently
depending on whether a Calendar is specified or not, even if the default calendar is used.
> Take for example this statement:
>     VALUES CAST(? AS VARCHAR(30))
> I executed this statement twice with the same Timestamp instance. First like this:
>     ps.setTimestamp(1, ts);
> and then like this
>     ps.setTimestamp(1, ts, Calendar.getInstance());
> In this example, both of the methods should use the default Calendar to convert the timestamp
to a string. However, I see that they generate different strings:
> 2010-04-20 15:17:36.0 vs 2010-04-20 03:17:36
> Note there are two differences:
> 1) The method that takes a Calendar object does not show the fraction part (.0)
> 2) The method that takes a Calendar object is 12 hours off (03 instead of 15)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message