Category: ASP

C# How to convert String to DateTime

DateTime dt = DateTime.ParseExact("2006", "yyyy",CultureInfo.InvariantCulture);

DateTime dt = DateTime.ParseExact("20060531", "yyyyMMdd",CultureInfo.InvariantCulture);

DateTime dt = DateTime.ParseExact("2006/05/31", "yyyy/MM/dd",CultureInfo.InvariantCulture);


C#

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count: