Wednesday 4 April 2018

Convert AM/PM time to 24 hours format C#

C# hh:mm tt (12 Hours to 24 Hours Format) convert


using System.Globalization;

var cultureSource = new CultureInfo("en-US", false);
var cultureDest = new CultureInfo("de-DE", false);
var source = "03:00 PM";

 var dt = DateTime.Parse(source, cultureSource);
  Response.Write(dt.ToString("t", cultureDest));

No comments:

Post a Comment

Upload valid file in C#

    protected bool CheckFileExtandLength(HttpPostedFile HtmlDocFile)     {         try         {             Dictionary<string, byte[]>...