DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Help to Translate C language to PL/SQL

  1. #1
    Join Date
    Jan 2002
    Posts
    22
    Hello,
    I need to translate this instruccion in C language
    to PL/SQL :


    localtime();

    "The localtime() function shall convert the time in seconds since the Epoch (January 1, 1970 0:00 UTC) pointed to by timer into a broken-down time, expressed as a local time. The function corrects for the timezone and any seasonal time adjustments. "

    Thanks in advance.

  2. #2
    Join Date
    Jan 2002
    Posts
    57
    Since you did not say what version of Oracle you are using I'm going to assume 9i.

    I have not tested this, but it should get you on the right track.

    declare
    epoch timestamp with time zone;
    other_date timestamp with time zone;
    interval number;
    begin
    interval := 1000000000;
    epoch := timestamp '1970-01-01 00:00:00.000000 GMT';
    other_date := epoch + interval / 3600 / 24;
    dbms_output.put_line(to_char(other_date));
    end;
    /

    --
    Paul

  3. #3
    Join Date
    Jan 2002
    Posts
    22

    In Oracle 8 is possible ?

    In Oracle 8 is possible ?

  4. #4
    Join Date
    Jan 2002
    Posts
    57
    You could use the date type instead of timestamp. If you do this you will have to handle timezones in your code.

    --
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width