2 Replies Latest reply on Jun 19, 2015 11:27 AM by Jonathan Espinal

    DB2 date format CYYMMDD

    Jonathan Espinal

      Hi everyone!!


      I'm in a hurry and I really need help.


      Im working on a little demo where my data source is DB2 (is a pain in the *** by the way), the thing is that I have a twbx file and it contains a field that I rename as DATE and it comes in this format CYYMMDD where "C" is the Century, but I dont need that, I just want the date in this format YYMMDD, I've been trying to do this using some of the date functions in Tableau but I can't get rid out of that "C" character in the date.


      Originally that field is recognized as a measure but I change it to a dimension and still as a numeric field so anyone has faced this same problem or could anyone help me with this please please please!!


      The twbx file is attached.


      Thank's and kind regards.

        • 1. Re: DB2 date format CYYMMDD
          Tableau kumar

          Hi Jonathan Espinal,


          You can get the solution by manually, creating the Calculations to extracting Parts of the Date then make it as Date.


          1) Year

          int( "20"+MID([Field], 2,3) )


          2) Month

          MID([Field], 4,5)


          3) Day

          MID([Field], 6,7)

          4) Getting Actual Date

          Date( str( [Year] ) +  "/"  + str ([Month] ) +  "/"  + str([Day])

          I did not test the above calculations, Since you need it urgently.

          Best Regards

          Laxman Kumar

          • 2. Re: DB2 date format CYYMMDD
            Jonathan Espinal

            Hi @