How to Parse Twitter's Date Time Format with C#

The Twitter API has its own custom date time format.

Tue Dec 01 22:35:28 +0000 2015

DateTime.Parse will barf if you try to parse it.

I searched around a bit and didn’t find a quick resolution. Luckily I do know Matt Johnson aka “DateTime Guy” aka Date and Time Fundamentals Pluralsight Course Author aka Hanselminutes guest…. and he was on IM. He, of course, is very familiar with Twitter’s date format and helped me come up with a couple of options. One for DateTime and one for DateTimeOffset – he recommends DateTimeOffset so I went with that.

Thanks Matt.

Hope this helps.

Jon

Share