db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: DATE() function issue
Date Fri, 19 Apr 2013 21:58:07 GMT
Oleksii Puzyr <opuzyr@gmail.com> writes:

> Hi all,
>
> Using embedded 10.10.1.1:
>
> CREATE TABLE TEST
> (
>     ID INT NOT NULL,
>     DATE TIMESTAMP NOT NULL
> );
>
> insert into test(id, date) values (1,'1988-12-25 18:00:34');
> select date(date),date from test;
>
> Result:
> '1988-12-24',	'1988-12-25 17:00:34'
>
> Please explain why date() result is not as expected (I expect it to be '1988-12-25')
and timestamp is one hour before?

I don't know why you're seeing these results. I see the expected values
in my environment:

ij version 10.10
ij> connect 'jdbc:derby:memory:db;create=true';
ij> CREATE TABLE TEST
(
    ID INT NOT NULL,
    DATE TIMESTAMP NOT NULL
);
0 rows inserted/updated/deleted
ij> insert into test(id, date) values (1,'1988-12-25 18:00:34');
1 row inserted/updated/deleted
ij> select date(date),date from test;
1         |DATE                         
----------------------------------------
1988-12-25|1988-12-25 18:00:34.0        

1 row selected

Maybe it's triggered by something special in your environment. What OS
and which Java version did you see this happening on? What's the time
zone on your computer? Is it reproducible every time?

Thanks,

-- 
Knut Anders

Mime
View raw message