You are hereDateTime.TryParse Method (String, IFormatProvider, DateTimeStyles, DateTime) (System)

DateTime.TryParse Method (String, IFormatProvider, DateTimeStyles, DateTime) (System)

By stoneseq - Posted on 29 November 2013

string dateString;
CultureInfo culture;
DateTimeStyles styles;
DateTime dateResult;

// Parse a date and time with no styles.
dateString = "03/01/2009 10:00 AM";
culture = CultureInfo.CreateSpecificCulture("en-US");
styles = DateTimeStyles.None;
if (DateTime.TryParse(dateString, culture, styles, out dateResult))
Console.WriteLine("{0} converted to {1} {2}.",
dateString, dateResult, dateResult.Kind);
Console.WriteLine("Unable to convert {0} to a date and time.",


This question is for testing whether you are a human visitor and to prevent automated spam submissions.
16 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Subscribe to Getzy by e-mail

Delivered by FeedBurner


Syndicate content