Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Oracle date to unix timestamp

677729Mar 13 2010 — edited Mar 14 2010
Hi..

1. What is the command to convert oracle date to unix timestamp ?
2. What is the command to convert unix timestamp to oracle date ?

This is my conversion query, but when i convert back to oracle date in different server the time become late 1 hour. Why this is happened ?... is there any problem on my sessiontimezone or dbtimezone configuration ?

create or replace FUNCTION oracle_to_unix
(
in_date IN DATE)
RETURN NUMBER
IS
BEGIN
RETURN (in_date -TO_DATE('19700101','yyyymmdd'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))*3600;
END;


Please help me ...

Thank you,
Baharin
This post has been answered by ttt on Mar 14 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2010
Added on Mar 13 2010
1 comment
20,296 views