Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Time Stamp calculations
Here's where i'm at:
create or replace procedure user.unix_date
(currentdate IN date) as
BEGIN
if currentdate is null then
dbms_output.putline('The current date is null')
;
return;
end if;
select trunc(sysdate-to_date('19700101','yyyymmdd'))*24*60*60 from dual;
end;
This supposedly will take in a variable currentdate and figure out the seconds from jan 1 1970,, and return that value. Not for some reason this won't compile although the sql statement works the problem lies elsewhere. Thanks for the help so far.
Joshua
damorgan <dan.morgan_at_ci.seattle.wa.us> wrote in message news:<3C5EEEDE.5BB5D100_at_ci.seattle.wa.us>...
> There may be another way, probably is in Oracle. But why not subtract
> 01-JAN-1970 from SYSDATE and then multiply your way to seconds.
>
> Daniel Morgan
>
>
>
> Joshua Goodstein wrote:
>
> > I am trying to create a procedure that changes the sysdate in Oracle
> > to the UNIX time to store in a field. aka i execute the
> > function/proocedure and it will insert the seconds since Jan 1 1970 in
> > the feild. IS there a procedure that does this already? Thanks in
> > advance
> >
> > I want sysdate to unix date, not unix date to sysdate.
> >
> > thanks in advance
> >
> > J
Received on Tue Feb 05 2002 - 07:14:23 CST
![]() |
![]() |