Tries to converts a string to DateTimeOffset(String with date only)
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
DateTimeOffset parsedDate;
string dateString;
// String with date only
dateString = "05/01/2008";
if (DateTimeOffset.TryParse(dateString, out parsedDate))
Console.WriteLine("{0} was converted to to {1}.", dateString, parsedDate);
}
}
Related examples in the same category