DateTime dateTime = DateTime.Now;
string strMinFormat = dateTime.ToString("hh:mm:ss tt");//12 hours format
string strMaxFormat = dateTime.ToString("HH:mm:ss tt");//24 hours format
using System;
class Solution
{
static string timeConversion(string s)
{
return DateTime.Parse(s).ToString("HH:mm");
}
static void Main(string[] args)
{
Console.WriteLine(timeConversion("01:00 PM"));
Console.Read();
}
}
using System;
namespace Demo {
public class Program {
public static void Main(string[] args) {
DateTime d = DateTime.Parse("05:00 PM");
Console.WriteLine(d.ToString("HH:mm"));
}
}
}