user3052850
user3052850

Reputation: 178

SSIS Convert yyyy-mm-dd hh:mm to ISO8601

I need to transform a date in a csv file with SSIS, i will not load it into a DB only load it back to the csv.

The date format is; 2019-07-02 04:16

And I need it to be; 2019-07-02T04:16:29

I can't find any expression to help me with this and would gladly get some help along the way.

Upvotes: 1

Views: 873

Answers (1)

Hadi
Hadi

Reputation: 37348

I will assume that the column data type is DT_STR or DT_WSTR since it is stored in a csv file.

You can use the following expression to convert from yyyy-MM-dd HH:mm format to yyyy-MM-ddTHH:mm:ss: (I added :00 at the end since the is no seconds in the first format)

TOKEN([DateColumn]," ",1) + "T" + TOKEN([DateColumn]," ",2) + ":00"

If the Initial column contains the seconds part then just use the following expression:

TOKEN([DateColumn]," ",1) + "T" + TOKEN([DateColumn]," ",2)

Upvotes: 2

Related Questions