Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: date format question
"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 MichelReceived on Thu May 17 2001 - 03:08:59 CDT
![]() |
![]() |