问题描述
我从XML文件获取到期日期并转换为datetime。它适用于调试模式。但在部署源代码后,它返回错误。
public LabelInfo ParseLabelsingalData(XmlNode Llist)
{
LabelInfo labelinfor = new LabelInfo();
labelinfor.ID = Llist.Attributes [Name]。值;
labelinfor.Name = Llist.Attributes [Name]。价值;
labelinfor.ExpiryDate = Convert.ToDateTime(Llist.Attributes [ExpiryDate]。Value);
}
我从xml获取日期,如31/01/2018
返回错误是 - 字符串未被识别为valide日期时间
我尝试过:
我试图转换日期时间labelinfor.ExpiryDate = Convert.ToDateTime(Llist.Attributes [ExpiryDate]。Value);
I am getting expiry date from XML file and convert to datetime. it's work on debug mode. but after deploy the source code it's return error.
public LabelInfo ParseLabelsingalData(XmlNode Llist)
{
LabelInfo labelinfor = new LabelInfo();
labelinfor.ID = Llist.Attributes["Name"].Value;
labelinfor.Name = Llist.Attributes["Name"].Value;
labelinfor.ExpiryDate = Convert.ToDateTime(Llist.Attributes["ExpiryDate"].Value);
}
I am getting date from xml like "31/01/2018"
return error is - string was not recognized as a valide datetime
What I have tried:
I have tried to convert date time labelinfor.ExpiryDate = Convert.ToDateTime(Llist.Attributes["ExpiryDate"].Value);
这篇关于调试我的C#windows应用程序datetime转换工作时。但是当它部署时它不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!