db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Raphael Mankin) <r...@mankin.org.uk>
Subject Re: DATEIME's value is adjusted by an hour without consent
Date Tue, 27 Sep 2005 17:00:02 GMT
Is the value that you *input* to the Torque code binary or character? If
characgter, where is the conversion to binary happening: in your applcication
code when you construct a java.util.time object, in the Torque library, or in
the server?

Similarly, on retrieval, where is the conversion from binary to character
happening? Is there perhaps a double conversin going on: mySQL returns a
character string in one time zone, Torque converts it to a java.sql.time object
in a different time zone and your application converts it back to character?

AFAICT mySQL stores datetime as binary values. When the value you specify is
converted to binary it is made absolute. Are the client and server running in
the same timezone? Even if they are on the same machine they might still be in
different timezones. For instance, the client may be in local time (GMT/BST
depending on the month) and the server in UTC.

This semlls very much of a difference in time zones. It really depends on
tracking down where the wrong assumption is being made. Try tinkering with the
client's timezone setting and see what effect it has.



On 27-Sep-2005 John Dunne wrote:
> Thanks Malcolm,
> 
> I believe the odd conversion I'm seeing lies with Torque since when I 
> read in a table row, the java.util.Date object I get back for the 
> DATETIME column is GMT British Summer Time which is incorrect since the 
> mysql database is storing the time value as UTC. I believe (correct me 
> if I'm wrong ayone!) Torque is confused to as what timezone the value it 
> read should be and assumed it to be the same as Java's default TimeZone 
> (which is currently GMT britishsummertime) resulting in the time 
> shifting by an hour (equal to the offset for british summer time) when 
> it is saved. Also, the long values are different just before save and on 
> retrival.
> 
> So, is it possible to inform Torque that a DATETIME value it reads from 
> a database is of a particular timezone?
> 
> Thanks,
> John.
> 
> 
> Malcolm Kendall wrote:
> 
>> Hi John,
>> Sounds like a display problem. Have you compared the long time value 
>> just before save and on retrieval.
>> I would check the locale settings for the client and server.
>> Regards,
>> Malcolm Kendall
>>
>> John Dunne wrote:
>>
>>> Hi All
>>>
>>>
>>> I'm experiencing a taxing problem I've not been able to find a 
>>> solution to on google!
>>>
>>> I've got a table with some DATETIME columns present. Whenever I call 
>>> save, the DATETIME column value gets put back by an hour. I'm 
>>> guessing that torque is converting the value from UTC to GMT (or vice 
>>> versa) but I've not found a way to alter this behaviour. Any ideas?
>>>
>>> Thanks in advance,
>>> John.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: torque-user-help@db.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

-- 
                               Lead us not into temptation; we
                               can find our own way.


Raphael Mankin
----------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message