数据转换十进制到日期时间

问题描述:

大家好,



我需要以下解决方案:



我有一个字段数据类型为decimal,长度为7,格式为yyyymmdd(fe 2007060)。



现在我需要将此字段传输到数据类型为dt_DBDATE或DT_DBDATE的字段中。 />


我想在SSIS中使用脚本组件需要解决方案,我想要用脚本写的C#代码。



任何暗示给我!!!



先谢谢

Hi All,

I need a solution for the following:

I have a field with datatype decimal, length 7, in the form yyyymmdd (f.e. 2007060).

Now I need to transfer this field into a field with datatype dt_DBDATE or DT_DBDATE.

I want requiring solution using a Script component in SSIS and i want C# code which is write in Script.

Any hint for me!!!

Thanks in Advance

privae DateTime convertDate()

       {
           string inputDate = "20140214";
           DateTime outputDate = Convert.ToDateTime(inputDate.Substring(4, 2) + "/" + inputDate.Substring(5, 2) + "/" + inputDate.Substring(0, 4));
           return outputDate;

       }