Hi Developers, I am working on SSIS in my XML file I have reading dates like 2013-08-02, 2013-08-4, 2013-08-05 but I have to change the data date to from last two days, What I mean is that the data date stamp should be changed to 2017-05-21,2017-05-22,2017-05-22.
What I have tried:
what I was done is added a derived column in the SSIS package and changed the expression with GETDATE() in this case I am getting only today date, But I need to change data from last two days. Can anyone help me?
Change the date in ssis package for XML file
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Amira BedhiafiRank #601 · 4K reputationPosted Mar 19, 2025, 6:21 PM EDT
You can use a derived column transformation :
(DT_DBTIMESTAMP)DATEADD("day", -2, GETDATE())If you need different dates for different rows, you can use conditional expressions based on existing logic. If you need a rolling two-day period, you can apply:
(DT_DBTIMESTAMP)DATEADD("day", -1, GETDATE()) -- Yesterday (DT_DBTIMESTAMP)DATEADD("day", -2, GETDATE()) -- Two days agoIf you are comfortable with C# you can use a script task :
public override void Input0_ProcessInputRow(Input0Buffer Row) { if (!Row.MyDateColumn_IsNull) // Replace with actual column name { Row.MyDateColumn = DateTime.Now.AddDays(-2); // Set to two days ago } }