Sitecore 5.0 API

DateUtil.FormatIsoDate Method (String, String)

Formats an ISO formatted date/time string using a specified format.

[Visual Basic]
Overloads Public Shared Function FormatIsoDate( _
   ByVal isoDate As String, _
   ByVal format As String _
) As String
[C#]
public static string FormatIsoDate(
   string isoDate,
   string format
);

Parameters

isoDate
A ISO formatted date/time string.
format
The target format.

Return Value

The formatted date/time. If the date/time string is not valied, blank is returned.

Remarks

The format is specified using .NET formatting codes. See here for more information.

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

Example

The following example returns Now formatted as a short date pattern.

  string isoNow = DateUtil.DateTimeToIsoDate(DateTime.Now);
  return DateUtil.FormatIsoDate(isoNow, "d");

See Also

DateUtil Class | Sitecore Namespace | DateUtil.FormatIsoDate Overload List