Java date long value changed after insert, select query

Posted by StackExploded on Stack Overflow See other posts from Stack Overflow or by StackExploded
Published on 2012-10-11T15:27:17Z Indexed on 2012/10/11 15:37 UTC
Read the original article Hit count: 128

Filed under:
|
|

AFAIK, java Date type is independent from Timezone which means that it represents specific moment of time as long typed value. I found really weird thing here.

This is the original value i tried to insert.

(http-0.0.0.0-9080-4) 1352955600000 <-- long integer.

(http-0.0.0.0-9080-4) Thu Nov 15 00:00:00 EST 2012 <-- User Friendly Format.

After i finished inserting into Oracle 11g database, the value has changed!

(http-0.0.0.0-9080-4) 1352952000000

(http-0.0.0.0-9080-4) Wed Nov 14 23:00:00 EST 2012

How could this happen?? The more weird thing is it only happens specific environments such as Jboss. I'm currently using below environments.

  • java 1.6
  • ibatis 2.34
  • jboss-5.1 (server)
  • tomcat 6.0 (local)
  • oracle 11g

Is there anybody who can give me a clue or link to be helpful? it really bugging me!!

© Stack Overflow or respective owner

Related posts about java

Related posts about Oracle