Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将JSON日期时间2017-03-19T23:54:46转换为2017年3月19日下午11:54:46_C#_Json_Datetime_Ssis_Etl - Fatal编程技术网

C# 将JSON日期时间2017-03-19T23:54:46转换为2017年3月19日下午11:54:46

C# 将JSON日期时间2017-03-19T23:54:46转换为2017年3月19日下午11:54:46,c#,json,datetime,ssis,etl,C#,Json,Datetime,Ssis,Etl,如何在SSIS的脚本C#中执行此操作。当前日期时间是来自JSON列的字符串。我正在尝试执行以下操作 DateTime convertedDate = DateTime.Parse(dateString); 但错误表明CreationTime不在当前上下文中 public override void Input0_ProcessInputRow(Input0Buffer Row) 及 但是仍然会出现相同的错误。尝试使用DateTime.ParseExact()函数 CultureInfo pr

如何在SSIS的脚本
C#
中执行此操作。当前日期时间是来自
JSON
列的字符串。我正在尝试执行以下操作

DateTime convertedDate = DateTime.Parse(dateString);
但错误表明
CreationTime
不在当前上下文中

public override void Input0_ProcessInputRow(Input0Buffer Row)


但是仍然会出现相同的错误。

尝试使用
DateTime.ParseExact()
函数

CultureInfo provider = CultureInfo.InvariantCulture;
DateTime convertedDate = DateTime.ParseExact(dateString,"yyyy-MM-ddTHH:mm:ss",provider);
如果需要以字符串形式返回,格式如下
MM/dd/yyyy hh:MM:ss tt
,则可以使用
ToString()
函数

String strDate = convertedDate.ToString("MM/dd/yyyy hh:mm:ss tt");
参考

您在问c代码,为什么要标记SSI、etl和sql server而不是c代码?
String strDate = convertedDate.ToString("MM/dd/yyyy hh:mm:ss tt");