0
我在外地的一个在SharePoint列表保存DateTime值:日期为1天关闭,而检索
//request is an entity that has all he fields in the list, I am only showing DueDate in the below code
if (txtdatepicker.Text != String.Empty)
{
DateTime dueDate;
if (DateTime.TryParse(txtdatepicker.Text, out dueDate))
{
request.DueDate = dueDate;//Output {9/30/2017 12:00:00 AM}
}
}
日期是正确保存在SharePoint列表作为截止日期:9/30/2017
。
现在的问题是,当我尝试检索此日期值:
if (LI[Constants.FieldName_ReqLst_DueDate] != null)
req.DueDate = (DateTime)LI[Constants.FieldName_ReqLst_DueDate];//Output {9/29/2017 6:30:00 PM}
我来到这里的输出是从所保存的价值完全不同。我如何从SharPoint DateTime列中获取正确的Date值?
我试了DateTime.Parse(Convert.ToString(LI[Constants.FieldName_ReqLst_DueDate])).ToLocalTime()
在本地机器上正常工作,但如果部署在服务器上,那么它不起作用。