This topic has not yet been rated - Rate this topic

SPUtility.CreateISO8601DateTimeFromSystemDateTime Method

Converts a system DateTime value to ISO8601 DateTime format (yyyy-mm-ddThh:mm:ssZ).

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public static string CreateISO8601DateTimeFromSystemDateTime(
	DateTime dtValue
)

Parameters

dtValue
Type: System.DateTime
A System.DateTime object that represents the system DateTime value in the form mm/dd/yyyy hh:mm:ss AM or PM.

Return Value

Type: System.String
A string that contains the date and time in ISO8601 DateTime format.

The CreateISO8601DateTimeFromSystemDateTime method converts, for example, "6/16/2003 6:37:44 PM" to "2003-06-16T18:37:44Z".

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Is the format correct?
I think the format should be yyyy-MM-ddTHH:mm:ssZ, not yyyy-mm-ddThh:mm:ssZ (tested on SPF 2010).
SharePoint DateTime Format Conversions Help
Do check out this link for help on SharePoint DateTime Format Conversions:

http://prasanjitmandal.blogspot.com/2010/06/sharepoint-datetime-format-conversions.html