SPUtility.ParseDate Method (SPWeb, String, SPDateFormat, Boolean)
Creates a System.DateTime object from the specified strings containing date and time values.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Shared Function ParseDate ( _
web As SPWeb, _
stDateTime As String, _
format As SPDateFormat, _
bToUTC As Boolean _
) As DateTime
'Usage
Dim web As SPWeb
Dim stDateTime As String
Dim format As SPDateFormat
Dim bToUTC As Boolean
Dim returnValue As DateTime
returnValue = SPUtility.ParseDate(web, _
stDateTime, format, bToUTC)
public static DateTime ParseDate(
SPWeb web,
string stDateTime,
SPDateFormat format,
bool bToUTC
)
Parameters
web
Type: Microsoft.SharePoint.SPWebAn Microsoft.SharePoint.SPWeb object that represents the site in which the date and time value is used.
stDateTime
Type: System.StringA string that contains the date and time.
format
Type: Microsoft.SharePoint.Utilities.SPDateFormatAn SPDateFormat enumeration value that determines the format of the date output.
bToUTC
Type: System.Booleantrue to convert data and time strings into a System.DateTime object in Coordinated Universal Time (UTC) time; false to convert the strings into a System.DateTime object in local time for the site.
Return Value
Type: System.DateTime
A System.DateTime object that contains the date and time.