Sitecore 5.1.1 API

DateUtil.GetIsoDateParts Method 

Gets the parts of an ISO formatted date/time string (Year, Month, Day, Hour, Minute, Second).

[Visual Basic]
Public Shared Function GetIsoDateParts( _
   ByVal isoDate As String _
) As Integer()
[C#]
public static int[] GetIsoDateParts(
   string isoDate
);

Parameters

isoDate
An ISO formatted date/time string.

Return Value

An integer array containing the parts of the date. If the date/time is not valid, null is returned.

Remarks

The integer array contains the following parts:

  1. Year
  2. Month
  3. Day
  4. Hour
  5. Minute
  6. Second
The time part can be omitted.

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

Example

The following example returns the month of an ISO date/time.

  string isoNow = DateUtil.IsoNow;
  int[] parts = DateUtil.GetIsoDateParts(isoNow);
  return parts[1]; // month

See Also

DateUtil Class | Sitecore Namespace