DateTimeOffset format: yyyy
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
DateTimeOffset theTime = new DateTimeOffset(2008, 2, 17, 9, 0, 0, DateTimeOffset.Now.Offset);
Console.WriteLine("The year component of {0} is {1}.",theTime, theTime.ToString("yyyy"));
}
}
Related examples in the same category