Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: Transformation of date format

    Hallo everyone,

    I have a column "arrival" in my table. The format is like this:
    31012012

    I would like to transform this in a db2 date format. As I know, the date format in db2 for date is:
    2012-01-31

    Could you please give me some clues how I can do this? Should I handle the "arrival" values as string? Thank you..

    Regards,
    Ratna

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Cast to string (if numeric) and then substring it in the right order with the dashes.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Nov 2011
    Posts
    334
    You can try this :
    db2 "values (translate( 'efgh-cd-ab', '31012012', 'abcdefgh' ))"

Posting Permissions

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