Compartilhar via


SPUtility.FormatDate Method

Converts the specified date and time value to an SPDateFormat format.

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 FormatDate ( _
    web As SPWeb, _
    date As DateTime, _
    fmt As SPDateFormat _
) As String
'Usage
Dim web As SPWeb
Dim date As DateTime
Dim fmt As SPDateFormat
Dim returnValue As String

returnValue = SPUtility.FormatDate(web, _
    date, fmt)
public static string FormatDate(
    SPWeb web,
    DateTime date,
    SPDateFormat fmt
)

Parameters

  • date
    Type: System.DateTime

    A System.DateTime object that represents the value to convert.

Return Value

Type: System.String
A string that contains the reformatted date and time value.

See Also

Reference

SPUtility Class

SPUtility Members

Microsoft.SharePoint.Utilities Namespace