William Duffy

Glasgow Based C# ASP.NET Web Developer

Tag archive for ‘DateTime’

Ordinal Suffix DateTime Extension Method

In my opinion the most annoying missing piece of date functionality in the .NET framework is an ability to get a DateTime’s ordinal suffix. If you’re as disheartened as me with this then dismay no more. Below is my DateTime extension method that returns the ordinal suffix for the current day of the month. I’ve [...]

Parsing dates when ASP.NET’s DateTime.Parse doesn’t work

Has DateTime.Parse ever thrown the following exception when you passed it a legally formatted value, leaving you bemused as to why it can’t parse it? String was not recognized as a valid DateTime As powerful as DateTime.Parse is, it cannot handle every representation of a date/time value without a little help from you, the developer. [...]