DateTimeOffset format: M (3)
using System;
using System.Globalization;
public class Test
{
public static void Main()
{
DateTimeOffset theTime = new DateTimeOffset(2008, 9, 7, 11, 25, 0, DateTimeOffset.Now.Offset);
Console.WriteLine("The month component of {0} is{1}.", theTime, theTime.ToString(" M"));
}
}
//The month component of 9/7/2008 11:25:00 AM -08:00 is 9.
Related examples in the same category