Tries to converts a string to DateTimeOffset(String with time only)
using System; using System.Globalization; public class Example { public static void Main() { DateTimeOffset parsedDate; string dateString; // String with time only dateString = "11:36 PM"; if (DateTimeOffset.TryParse(dateString, out parsedDate)) Console.WriteLine("{0} was converted to to {1}.", dateString, parsedDate); } }