Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2016
    Posts
    1

    Unanswered: Convert between Unix Timestamp and Oracle Date

    Hi

    I wrote a function for transfering a UNIX Timestamp (number of seconds from 01.01.19000) to a Oracle Date and I get a summertime/wintertime problem. The Unix Timestamp does not know anything from summer or wintertime. It only counts the number of seconds. In this function I used this to transform the Unix Timestamp into a Oracle DATE:

    converted_date := FROM_TZ(TO_TIMESTAMP('1970-01-01','YYYY-MM-DD') + (<THE_UNIX_TIMESTAMP> / (60 * 60 * 24)), 'UTC')

    How can I automatically convert the time with the right summer- and wintertime? I think I need the right string instead of "UTC".

    Can anybody help me?

    Thanks JeKl

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    What do you mean by summertime/wintertime problem?
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Try the following

    select to_date('1970-01-01','YYYY-MM-DD') + numtodsinterval(1234567890,'SECOND')
    from dual;

    where 1234567890 is the unix timestamp that you are attempting to convert
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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