SPFieldDateTime.GetFieldValueAsText method (Object)

Returns the specified field data value, expressed in Coordinated Universal Time (UTC) format, as a string.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Overrides Function GetFieldValueAsText ( _
    value As Object _
) As String
'Usage
Dim instance As SPFieldDateTime
Dim value As Object
Dim returnValue As String

returnValue = instance.GetFieldValueAsText(value)
public override string GetFieldValueAsText(
    Object value
)

Parameters

  • value
    Type: System.Object

    An object that represents the data value to convert in UTC format, as follows: YYYY-MM-DDTHH:MM:SSZ.

Return value

Type: System.String
A string that contains the field data value.

Remarks

The GetFieldValueAsText method requires that date and time values be in UTC format, while most SharePoint Foundation methods for returning list data return the values in local time. Consequently, when performing queries for list data, you need to convert time values to get expected results. To return items in UTC date and time, use an SPQuery object and set the DatesInUtc property to true, as seen in the following example:

Dim query As New SPQuery()
query.DatesInUtc = true
Dim listItems As SPListItemCollection = list.GetItems(query)
SPQuery query = new SPQuery();
query.DatesInUtc = true;
SPListItemCollection listItems = list.GetItems(query);

See also

Reference

SPFieldDateTime class

SPFieldDateTime members

GetFieldValueAsText overload

Microsoft.SharePoint namespace