Convert date from MMDDCCYY to YYYYMMDD
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Convert date from MMDDCCYY to YYYYMMDD

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    1

    Exclamation Convert date from MMDDCCYY to YYYYMMDD

    I have imported data from a fixed length format file into an external table in oracle which has several date fields in the format MMDDCCYY. I want to convert this into YYYYMMDD and insert it into another table in oracle with date field. A subset of the values to be converted is given below:
    DOB
    01051152
    10581111
    08151160
    01031151
    05131151
    01111126
    01511123
    11531112
    08531161
    06301162
    05521111
    06511115
    Any idea anybody.......

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    Quote Originally Posted by groovekarki View Post
    I have imported data from a fixed length format file into an external table in oracle which has several date fields in the format MMDDCCYY. I want to convert this into YYYYMMDD and insert it into another table in oracle with date field. A subset of the values to be converted is given below:
    DOB
    01051152
    10581111
    08151160
    01031151
    05131151
    01111126
    01511123
    11531112
    08531161
    06301162
    05521111
    06511115
    Any idea anybody.......
    Does your database really stores people born in the 12th century?

    Code below will do the trick...
    HTML Code:
    select  to_char(to_date('01051152','MMDDYYYY'),'YYYYMMDD')
    from    dual;
    11520105
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Tags for this Thread

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