posted 1/20/2011 by RussLoski - Views: [19327]
Most datetime expressions in SSIS include the time portion of the datetime as well as the date. The various system variable (CreationDate, StartTime) return a full datetime as well as the GetDate() expression function. What if you are only interested in the date portion?
The expression "(DT_DATE) (DT_DBDATE) <datetime element>" will return the simple date of the datetime element. For example "(DT_DATE) (DT_DBDATE) @[System::CreationDate]" returns the day that the package was created. "(DT_DATE) (DT_DBDATE) GetDate()".
The function (DT_DBDATE) converts the following expression to just a plain date, but the data type is not compatible with DateTime data type of SSIS. The function (DT_DATE) converts the DB_DATE data type to the DATETIME data type.
Hi RussLoski,
Great blog! If you want to take a look at some additional expressions, there is a great cheat sheet available for the more trickier ones: http://pragmaticworks.com/cheatsheet/.