を取得中に外れ1日である私は、SharePointリスト内のフィールドのいずれかにDateTime値を保存しています:日付値が
//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()
で試してみましたが、ローカルマシンでうまく動作しますが、サーバーにデプロイされていても動作しません。