1 Reply Latest reply on Apr 26, 2019 3:07 AM by Nico Heinze

    Date time conversion

    v kase Active Member

      I have date/time column in "2000-01-01 05:00:00.000" format and I want to convert it into "01/01/2000 05:00:00 AM" format. Please help.

        • 1. Re: Date time conversion
          Nico Heinze Guru

          That question is not really clear to me. A Date/Time value in PowerCenter is a Date/Time value and nothing else.

           

          What you have posted are different string formats for the same point in time, but that's a different story. You can always "translate" a Date/Time port to a string representation using the TO_CHAR() function (there's a chapter with loads of explanations for the different format parts in the Transformation Language guide for PowerCenter), but nonetheless this string is simply a representation of the Date/Time format and not the Date/Time value itself.

           

          In your case, if your Date/Time input port i_Date has a value of Jan 1st, 2000, at 5:00 A.M., then you can "translate" this to the format you've described above like this:

            TO_CHAR( i_Date, 'MM/DD/YYYY HH12:MI:SS AM')

           

          Regards,

          Nico