1

I have an oracle 10g table with a DATE column type. I need to compare it in a where clause to a value generated by a script that looks like this: TIMESTAMP '2016-05-12 08:00:00.258000 +00:00'. I cannot control the generated TIMESTAMP part, and when I do:

RECORDEDTIME >= TIMESTAMP '2016-05-12 08:00:00.258000 +00:00' it uses the localtime of the RECORDEDTIME which means I am 4 hours off. What function do I call on RECORDEDTIME to get it in UTC matching the other value in the WHERE clause (i.e. it needs to subtract 4 hours as I'm in EST)

asked May 12, 2016 at 13:03

2 Answers 2

1

SYS_EXTRACT_UTC

SQL> SELECT SYS_EXTRACT_UTC(TIMESTAMP '2000-03-28 11:30:00.00 -08:00') FROM DUAL;
SYS_EXTRACT_UTC(TIMESTAMP'2000-03-.&checktime(2811,30,00,':').00-08:00')
---------------------------------------------------------------------------
28-MAR-00 07.30.00.000000000 PM
answered May 12, 2016 at 13:08
1
  • I assume it would be rather WHERE SYS_EXTRACT_UTC(RECORDEDTIME) = TIMESTAMP '2016年05月12日 08:00:00.258000 +00:00', resp. WHERE SYS_EXTRACT_UTC(CAST(RECORDEDTIME) AS TIMESTAMP) AT '+04:00')= TIMESTAMP '2016年05月12日 08:00:00.258000 +00:00' Commented May 14, 2016 at 11:30
0

I would suggest to use where recordtime >= TIMESTAMP '2016-05-12 08:00:00.258000 +00:00' AT LOCAL

answered May 14, 2016 at 15:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.