In an attempt to turn a date with a format of \"mm/dd/yyyy hh:mm:ss PM\"
into military time, the following replacement of a row value does not seem to take. Eve
If you have this time: 07:12:02PM and you want this: 19:12:02PM, then this is the code for you!
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static string timeConversion(string s) {
DateTime dateTime = DateTime.ParseExact(s, "hh:mm:sstt",
System.Globalization.CultureInfo.InvariantCulture);
return (dateTime.ToString("HH:mm:ss"));
}
static void Main(String[] args) {
string s = Console.ReadLine();
string result = timeConversion(s);
Console.WriteLine(result);
}
}