SQLTeam.com | Weblogs | Forums

Date issue with ssis


#1

hi

i have the following code in my ssis package to convert dates.

(MONTH(MaturityDate) < 10 ? "0" + (DT_WSTR,2)MONTH(MaturityDate) + "/" : (DT_WSTR,2)MONTH(MaturityDate) + "/") + (DAY(MaturityDate) < 10 ? "0" + (DT_WSTR,2)DAY(MaturityDate) + "/" : (DT_WSTR,2)DAY(MaturityDate) + "/") + (DT_WSTR,4)DATEPART("yyyy",MaturityDate)

the date comes out in the table as 2016-06-01 00:00:00.000. but the date should be 6th of jan not the 1st of june.

anyone now why this is happening


#2

maturity date in the file comes in as 20160106


#3

I did it like this:

(DT_DBTIMESTAMP)(LEFT(MaturityDate,4) + "-" + RIGHT(MaturityDate,2)) + "-" + SUBSTRING(MaturityDate,5,2)