// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) /* * Created by SharpDevelop. * User: Arne * Date: 04-11-2007 * Time: 16:34 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Globalization; namespace E9 { class Program { public static void Main(string[] args) { DateTime result; result = DateTime.ParseExact("1999-12-01T23:59:59", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); Console.WriteLine(result); result = DateTime.ParseExact("1999-12-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); Console.WriteLine(result); result = DateTime.ParseExact("1999-12-01T23:59:59-5", "yyyy-MM-ddTHH:mm:ssz", CultureInfo.InvariantCulture); Console.WriteLine(result); result = DateTime.ParseExact("1999-12-01T23:59:59+0", "yyyy-MM-ddTHH:mm:ssz", CultureInfo.InvariantCulture); Console.WriteLine(result); } } }