数据转换十进制到日期时间 [英] Data Conversion decimal to datetime

查看:173
本文介绍了数据转换十进制到日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要以下解决方案:



我有一个字段数据类型为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;

       }


这篇关于数据转换十进制到日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆