Skip to content

Instantly share code, notes, and snippets.

@feanz
Created November 27, 2013 11:30
Show Gist options
  • Save feanz/7674254 to your computer and use it in GitHub Desktop.
Save feanz/7674254 to your computer and use it in GitHub Desktop.
DaySuffix
public static string DaySuffix(this DateTime dateTime)
{
return (dateTime.Day == 1)
? "st"
: (dateTime.Day == 2)
? "nd"
: (dateTime.Day == 3)
? "rd"
: "th";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment