C#/.NET Little Wonders: The DateTime TryParsae() and ParseExact() Meth

added by BlackRabbitCoder
1/5/2012 6:44:28 PM

0 Kicks, 73 Views

A while back I talked about some goodies in DateTime, mostly the properties that let you split out just the date or time. This week, I wanted to look at a couple more methods of the DateTime struct that give you additional control over parsing an input string into a DateTime. Most of us have dealt with using DateTime.Parse() for these tasks, but sometimes you are wanting to parse something that may not be a valid DateTime, or may be in a non-standard format. So let’s look at the TryParse() and ParseExact() methods that can be used to deal with these two situations.


1/5/2012 6:44:46 PM
new post