I have a timestamp format liek the following passed to me to add to a database: 20080203171600Z-0400
I had a hard time trying to put this in Oracle, but I finally figured it out:
INSERT INTO test_timestamp VALUES
(TO_TIMESTAMP_TZ(REPLACE ('20050203171600Z-0400','Z',' '),'yyyymmddhh24miss TZHTZM'));
test_timestamp has a column with type: TIMESTAMP(0) WITH TIME ZONE
When I retrive this from a resultset, I use the getTimestamp("TEST_TMSTP");
When I use the same date using SimpleDateFormat and call getTime on both, I get different values... Why is that?
SimpleDateFormat fmtTimestamp = new SimpleDateFormat ("yyyyMMddHHmmssZ");
fmtTimestamp.parse(timestamp.replaceAll("Z", ""));
getTimestamp("TEST_TMSTP") = 1107472560000
fmtTimestamp.parse(timestamp.replaceAll("Z", "")) = 1107465360000
Why are these numbers not the same?
I had a hard time trying to put this in Oracle, but I finally figured it out:
INSERT INTO test_timestamp VALUES
(TO_TIMESTAMP_TZ(REPLACE ('20050203171600Z-0400','Z',' '),'yyyymmddhh24miss TZHTZM'));
test_timestamp has a column with type: TIMESTAMP(0) WITH TIME ZONE
When I retrive this from a resultset, I use the getTimestamp("TEST_TMSTP");
When I use the same date using SimpleDateFormat and call getTime on both, I get different values... Why is that?
SimpleDateFormat fmtTimestamp = new SimpleDateFormat ("yyyyMMddHHmmssZ");
fmtTimestamp.parse(timestamp.replaceAll("Z", ""));
getTimestamp("TEST_TMSTP") = 1107472560000
fmtTimestamp.parse(timestamp.replaceAll("Z", "")) = 1107465360000
Why are these numbers not the same?