Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: date format question

Re: date format question

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 17 May 2001 10:08:59 +0200
Message-ID: <9e00v0$scq$1@s1.read.news.oleane.net>

"Zhiliang Hu" <zhu_at_genomicfx.com> a écrit dans le message news: 3B02FC37.1AB2E197_at_genomicfx.com...
>
> How to format an Oracle date to be shown as the number of seconds since
> 1970?
>
> Thanks!
>
> Zhiliang
>

Here's a function to convert an Oracle date to your number of seconds:

create or replace function date_to_unix (datein date) return number is begin

   return to_number(to_char(datein,'J'))*86400+to_number(to_char(datein,'SSSSS'))-

          to_number(to_char(to_date('01/01/1970','DD/MM/YYYY'),'J'))*86400; end date_to_unix;
/

--
Have a nice day
Michel
Received on Thu May 17 2001 - 03:08:59 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US