Wyle Cordero
Wyle Cordero

Reputation: 31

C# SSIS Script Component Format Input Date Row to "MMddyyyy"

I am currently working on a Transformation component script. I want to format the input date columns to "MMddYYYY".

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    /*
     * Add your code here
     */

    Row.SampleDate = Convert.ToDateTime(Row.SampleDate.ToString("MM/dd/yyyy"));
    Row.TestDate = Convert.ToDateTime(Row.TestDate.ToString("MM/dd/yyyy"));
    Row.ComponentsTestDate = Convert.ToDateTime(Row.ComponentsTestDate.ToString("MM/dd/yyyy"));
}

I am still getting a timestamp value once the scripts executes:

enter image description here

Upvotes: 0

Views: 550

Answers (1)

Tab Alleman
Tab Alleman

Reputation: 31785

Strings have formats. DateTimes do not.

If you want to see your output in a specific format, you need your output column to be a string datatype.

Upvotes: 1

Related Questions