Torna al Thread

Public static bool ConvertoDate(string dateString, ref DateTime result) { try { string[] supportedFormats = new string[] { "MM/dd/yyyy", "MM/dd/yy", "ddMMMyyyy", "dMMMyyyy" }; result = DateTime.ParseExact(dateString, supportedFormats, System.Globalization.CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.None); return true; } catch (Exception ex) { return false; } }
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5