.Net Parse DateTime from String

I’m always forgetting the exact way to parse a DateTime from a String, so I’ll put it down in writing here so I can easily find it next time:
// E.g. 13 Jan 2010 15:30:01:123
DateTime.ParseExact(dateString, "dd MMM yyyy HH:mm:ss:fff", CultureInfo.CreateSpecificCulture("en-GB"))

For the format string see MSDN Custom Date and Time Format Strings

Advertisements

4 responses to “.Net Parse DateTime from String

  1. What was that all about?

    • It’s C# which is a Microsoft .Net programming language; I write computer software for a living. But sometimes I think it will be the death of me lol

      • When I first started work, way back in 1970, I became a computer operater, working on an ICL 1900 mainframe, it had ridiculously small memory, 32k if I remember correctly, and it filled the computer room. I remember we had an ICL engineer on site all the time to cover the breakdowns which were many. Oh, how times have changed, and computers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s