DateTimeOffset format: G (2)
using System;
using System.Globalization;
using System.Threading;
public class Example
{
public static void Main()
{
DateTimeOffset outputDate = new DateTimeOffset(2010, 5, 31, 21, 0, 0, new TimeSpan(-8, 0, 0));
string specifier;
specifier = "G";
// Displays G: 10/31/2007 9:00:00 PM
Console.WriteLine("{0}: {1}", specifier, outputDate.ToString(specifier));
}
}
//G: 5/31/2010 9:00:00 PM
Related examples in the same category