Converts string to DateTimeOffset using the specified culture-specific format information and formatting style.
using System; using System.Globalization; public class Test { public static void Main() { string dateString; DateTimeOffset offsetDate; dateString = "05/01/2008 6:00:00"; // Assume time is local offsetDate = DateTimeOffset.Parse(dateString, null, DateTimeStyles.AssumeLocal); Console.WriteLine(offsetDate.ToString()); } }