Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2012
    Posts
    3

    Question Unanswered: date formate reqired in DB2

    Join Date column store in table emp in 20120101 formate. howevere data type is date for Join date column. I need to convert this date to 'DD-MON-YYYY' formate. Please help asap.

  2. #2
    Join Date
    Mar 2003
    Posts
    280
    Quote Originally Posted by ashok_mli View Post
    Join Date column store in table emp in 20120101 formate. howevere data type is date for Join date column. I need to convert this date to 'DD-MON-YYYY' formate. Please help asap.
    What is 20120101, a number, a string? Also, please read:

    http://www.dbforums.com/db2/854783-m...e-posting.html

    Code:
    with t(i) as ( values char(20120101) ) 
    select cast( (substr(s,1,4) || '-' || substr(s,5,2) || '-' || substr(s,7,2)) as date) from t
    --
    Lennart

  3. #3
    Join Date
    Nov 2012
    Posts
    3
    thanks for reply...

    20120101 is a date.

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    date columns are always in format yyyy-mm-dd
    you can change the display if needed or control this with default bind options
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

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