[英]String was not recognized as a valid DateTime in Biztalk Mapping
我们在LINQPad 5中具有以下代码,该代码进行编译并提供预期的输出:
void Main(){
Console.WriteLine(thissucks("Sometext. IfCondition: 20180125.")); }
public string thissucks(string inputString){
string[] words = inputString.Split(':');
string date = words.GetValue(1).ToString();
string comment = words.GetValue(0).ToString();
date = date.Replace(".","");
date = date.Trim();
if (inputString.Contains("IfCondition"))
{
DateTime formatDate = DateTime.ParseExact(date,"yyyyMMdd", null);
return comment + ": " + formatDate.ToString("dd.MM.yyyy") + ".";
}
else
{
return inputString;
}
}
产生输出: Sometext. IfCondition: 25.01.2018
Sometext. IfCondition: 25.01.2018
但是,当我们将其放入biztalk映射中的脚本functoid中时,会出现错误“字符串未被识别为有效的DateTime”
如Panagiotis所建议,文件中的输入行发生此错误,并在无效的DateTime字符串后输入:
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.