Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    53

    Unanswered: convert Number to Date:

    Hi all,

    i have column dataty with number and i would like to convert to date but not getting any success:

    I have 20080625092308000 and would like to convert to 2008/06/25 and rest needs to be ignored:

    Thanks
    Pat

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    With a little help of the SUBSTR and TO_DATE functions, you might do it as following:
    Code:
    SQL> select to_date(substr('20080625092308000', 1, 8), 'yyyy/mm/dd') result
      2  from dual;
    
    RESULT
    ----------
    25.06.2008
    
    SQL>

  3. #3
    Join Date
    Jun 2005
    Posts
    53
    thanks a lot for help

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Since it is a number, this would also work


    Code:
    select to_date(to_char(floor(20080625092308000/1000000000)), 1, 8), 'yyyymmdd') result  
      from dual;
    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
  •