client timezone information needs to be handled also for modifications to timestamp values #2962
Date: 2012-01-01 06:16:16 +0100
Last updated: 2013-09-27 13:47:20 +0200
Date: 2012-01-01 06:16:16 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
current_date and current_timestamp are behaving in odd ways. It looks like the current_date ignores the local timezone and gives a date that is exactly 24 hours ahead. I think it is giving the correct local time, but is giving the date based on GMT. The current_timestamp gives correct result. But, if we extract the day (extract(day from current_timestamp), it also give a wrong result. On New Year's Eve (i.e. tonight), it gives wrong year, month, and day!
It is the New Year's Eve. And, the following query gives incorrect results.
"select current_date" results in 2012-01-01.
Steps to Reproduce:
It is the New Year's Eve. And, the following query gives incorrect result.
select current_date ====> 2012-01-01
Date: 2012-01-02 15:09:27 +0100
I'm assuming you're located somewhere West of Greenwich, UK. At the time you did your queries, it was already past midnight in Greenwich, and the server gave back the times in GMT (or UTC).
So, which client were you using for your test?
If not mclient, you could use something like
When using mclient for these queries, the results (for me) include the timezone information (after I fixed a bug in the DST determination):
Date: 2012-01-02 22:35:19 +0100
Yes. I am near Los Anageles, USA.
I was using DBVisualizer and mclient. For DBVisualizer, I was using JDBC driver version 1.17. I thought I got exact same results in both clients except the mclient did not account for the DST so it was off by 1 hour compared to what I was getting in DBVisualizer.
I think DBVisualizer tells the server what timezone I am in because current_time that I get from the server is the correct local time.
Let me try again later in the evening when it is past midnight in Greenwich. I thought I was getting results that did not look right even in mclient.....
Date: 2012-01-03 02:17:24 +0100
Ok. I ran the same queries in DBVisualizer and mclient.
from DBVisualizer around local time, 2012-01-02 17:05
current_date years months days
from mclient around local time, 2012-01-02 17:05
As you can see above, the just the times are off by 1 hour due to DST, perhaps. But, both clients return incorrect current_date. Extracting the year, month, or day from the current_date or current_timestamp returns the results from GMT, not from local timezone....
Where does the local timezone translation occur? Is it in the JDBC driver or the client? Thanks.
Date: 2012-01-03 08:29:04 +0100
JDBC sets the timezone you use on the server. Possibly it does this wrong, though.
Date: 2012-01-03 10:31:13 +0100
I now understand what goes wrong:
This is a problem that is not so easy to fix.
Date: 2012-01-04 04:04:58 +0100
Yes, you are right. I do get the wrong day when I extract it from the current_timestamp. I think your explanation of where/when the conversion occurs makes sense based on what we are seeing... Too bad, it is not an easy fix, though... That is not what I wanted to hear from the experts! :-)
Date: 2012-08-24 14:56:07 +0200
Jul2012-SP1 has been released.
Date: 2012-11-27 14:02:45 +0100
keep alias in the loop
Date: 2012-11-27 15:15:14 +0100
Still occurs in default and Oct2012. Added a test in revision 33598ae3797e
Date: 2012-11-28 13:45:42 +0100
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=ef4c8fa0fcb3
Date: 2013-08-25 15:49:24 +0200
functions with timestamp with time zone arguments (not returning timestamps) are now first transformed into the local timezone.
Date: 2013-08-25 16:23:37 +0200
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=0620e9df2003
The text was updated successfully, but these errors were encountered: