共用方式為


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

  • stDateTime
    Type: System.String

    A string that contains the date and time.

  • bToUTC
    Type: System.Boolean

    true 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.

See Also

Reference

SPUtility Class

SPUtility Members

ParseDate Overload

Microsoft.SharePoint.Utilities Namespace