Date / Time Stamp

From: The Magnet <art_at_unsu.com>
Date: Mon, 21 Feb 2011 08:31:20 -0800 (PST)
Message-ID: <898e7660-17d8-4637-99a7-c81616fc1ef1_at_a11g2000pro.googlegroups.com>



Hi,

Is there a good way to convert a date to the Unixtimestamp? We need to do this. I used the function below, but our developers are tells us it is not correct:

CREATE OR REPLACE FUNCTION EVENTS.oracle_to_unix_ts (   p_date DATE)
RETURN NUMBER IS v_timestamp NUMBER;

BEGIN
  SELECT (CAST(sysdate AS date) - p_date) * 86400 seconds   INTO v_timestamp
  FROM DUAL;
  RETURN v_timestamp;

END oracle_to_unix_ts; Received on Mon Feb 21 2011 - 10:31:20 CST

Original text of this message