Finding the Time in Different Zones

These days, many enterprises exchange data using a request/response approach. This data typically contains the date and time information regarding when a request was generated/received or a response generated/received. If they are in different time zones the following code/query can help in finding out the times in their respective zones.

 Select to_char(new_time(sysdate,'PST','EST'), _'dd-mm-yy hh24:mi:ss') from dual;

This gives the Date and time in in East Coast for the corresponding time in PST. For example: 9.00 am in PST is given as:

 SQL> select to_char(new_time(to_date('10/18/01 _9:00:00','MM/DD/YYHH24:MI:SS'),'PST','EST'), 'dd-mm-yy hh24:mi:ss') from dual;TO_CHAR(NEW_TIME(-----------------18-10-01 12:00:00

This can be used for different time zones like GMT,CST, and so on.It can also be used when storing information about request/response times.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: