Sitecore 5.1.1 API

DateUtil.ToIsoDate Method 

Converts a DateTime class to an ISO formatted date/time string.

[Visual Basic]
Public Shared Function ToIsoDate( _
   ByVal datetime As Date _
) As String
[C#]
public static string ToIsoDate(
   DateTime datetime
);

Parameters

datetime
A DateTime class to be formatted.

Return Value

The ISO formatted date/time equivalent of the DateTime class.

Remarks

The date/time string is formatted as "yyyyMMddTHHmmss".

Example

The following example returns Now formatted as an ISO date.

  return DateUtil.DateTimeToIsoDate(DateTime.Now);

See Also

DateUtil Class | Sitecore Namespace