Destination column data should in one format:
How to do the HireDate column in one format at destination table of sql server.
Destination column data should in one format:
How to do the HireDate column in one format at destination table of sql server.
Add a script component , Mark HireDate
as input column, add a new Output column outHireDate
with dataType DT_DBTIMESTAMP
In the script write the following:
Declare an array of formats:
Dim strFormats() as string = {"dd/MM/yyyy","yyyy/MM/dd","MM/dd/yyyy"}
And in Input0_ProcessInputRow
sub use DateTime.ParseExact
Function as follow:
Row.OutHireDate = DateTime.ParseExact(Row.HireDate,strFormats,New System.Globalization.CultureInfo("en-GB"))
Important note
It may cause conflict when day and month are lower than 13
(ex: 01/03/2010)