Reading values from list items in Sharepoint is no fun. I have created a method to read the value of a DateTime field in an SPItem:
private DateTime readSharepointDatefield(SPItem currentItem, string fieldName)
{
DateTime date = DateTime.MinValue;
if (currentItem.Fields[fieldName] != null)
{
if (!String.IsNullOrEmpty(currentItem.Fields[fieldName].GetFieldValueAsText(currentItem["PersberichtDatumMetKalender"])))
{
date = ((DateTime)(currentItem.Fields[fieldName].DefaultValueTyped)).Date;
}
}
return date;
}
a94219c9-9957-4053-89d0-a448fc0ec0aa|2|2.5