Results 1 to 11 of 11

Thread: Unix Timestamp

  1. #1
    Join Date
    May 2005
    Location
    Hull
    Posts
    22

    Unanswered: Unix Timestamp

    Probably a really simply question but...

    Can you put a unix timestamp into Oracle 10g using any built in function?
    "I hate quotes, tell me what you know"

  2. #2
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    I dont understand the question at all.

    Like.. what is that you want especifically ?

  3. #3
    Join Date
    May 2005
    Location
    Hull
    Posts
    22
    Seems pretty simple to me, a Unix Timestamp. You know what that is right? Seconds since the Unix Epoch (January 1st, 1970).
    "I hate quotes, tell me what you know"

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Try this:

    Code:
    select (sysdate - to_date('19700101','YYYYMMDD'))*24*60*60 from dual;

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  5. #5
    Join Date
    May 2005
    Location
    Hull
    Posts
    22
    Ah thank you, wasnt that difficult or did I explain wrong?
    "I hate quotes, tell me what you know"

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    In order to be 100% accurate, you need to compensate for time zone offset;
    since epoch time is based upon GMT.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    May 2005
    Location
    Hull
    Posts
    22
    I store the users timezone, the server is located in GMT. So after I fetch the date time I can apply the timezone difference for each user.
    "I hate quotes, tell me what you know"

  8. #8
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Just curious, why would you want to store a unix timestamp in an oracle database. An Oracle timestamp or date column is MUCH more accurate and the database is designed for ease of display, calculation, and manipulation of the stored date.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  9. #9
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Quote Originally Posted by beilstwh
    Just curious, why would you want to store a unix timestamp in an oracle database. An Oracle timestamp or date column is MUCH more accurate and the database is designed for ease of display, calculation, and manipulation of the stored date.
    Why not? It depends on the application requirements
    Last edited by LKBrwn_DBA; 01-27-06 at 12:12.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  10. #10
    Join Date
    May 2005
    Location
    Hull
    Posts
    22
    Quote Originally Posted by beilstwh
    Just curious, why would you want to store a unix timestamp in an oracle database. An Oracle timestamp or date column is MUCH more accurate and the database is designed for ease of display, calculation, and manipulation of the stored date.
    I am using PHP as the language. So I can format using the date() function, much easier.
    "I hate quotes, tell me what you know"

  11. #11
    Join Date
    Jan 2006
    Posts
    2
    Quote Originally Posted by LKBrwn_DBA
    Why not? It depends on the application requirements
    I imagine that is why Bill was curious. I could imagine a number of applications that wished to store UNIX timestamps. They'd all be recording data that natively had an attibute which was recorded in units of UNIX timestamp. This set of applications is much, much smaller than the set of applications that wish to store datetime information for which of course an appropriate datetime datatype would be a better choice. It looks to me from the follow up from the original author that Bill's question was well asked. It is probably that more useful responses could have been received to the related question. How do I process Oracle dates using the PHP language?

Posting Permissions

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