Created
October 25, 2013 11:32
-
-
Save csharpforevermore/7153258 to your computer and use it in GitHub Desktop.
Returns the text that comes after a digit in a date (e.g. 1 = 1st, 15 = 15th, 23 = 23rd, etc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetDaySuffix(int day) | |
{ | |
switch (day) | |
{ | |
case 1: | |
case 21: | |
case 31: | |
return "st"; | |
case 2: | |
case 22: | |
return "nd"; | |
case 3: | |
case 23: | |
return "rd"; | |
default: | |
return "th"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment