// 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) using System; class MainClass { public static void Test(int y, int m, int d) { try { DateTime dt = new DateTime(y, m, d); Console.WriteLine(y + " " + m + " " + d + " id valid"); } catch(ArgumentOutOfRangeException ex) { Console.WriteLine(y + " " + m + " " + d + " id not valid"); } } public static void Main(string[] args) { Test(2004, 2, 29); Test(2005, 2, 29); } }