F# - Parse dates
.net, datetime, f#
Solution
You should be able to use a custom format string. Try this:
System.DateTime.ParseExact("20100503", "yyyymmdd", null);;
See http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx for more details.
Problem
Very basic question regarding parsing date in F#. I am very new to F# and .NET, so please bear with me. My date has the format `yyyyMMDD` like `20100503`. How do I parse this into a `DateTime` type in F#. I tried `System.DateTime.Parse("20100503");` but get an error. How do I pass a format string into the Parse method?? ANSWER is - Thanks everyone for the responses. ``` let d = System.DateTime.ParseExact("20100503", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); ```