Assign date as a string to SharePoint’s DateTime type field


If you want to assign date as a string to SharePoint’s DateTime type field then you must format this string as an invariant date. The following line of code explains better what I mean.

item["MyDate"] = DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo);

If you guarantee that dates are in invariant format then you have no problems when assigning values to DateTime fields. Remember that invariant format is:

MM/dd/yyyy HH:mm:ss