Pchp.Library.DateTimeFunctions.GetDayNumberSuffix C# (CSharp) Method

GetDayNumberSuffix() private static method

English ordinal suffix for the day of the month, 2 characters - st, nd, rd or th.
private static GetDayNumberSuffix ( int DayNumber ) : string
DayNumber int Number of the day. In [1..31].
return string
        private static string GetDayNumberSuffix(int DayNumber /* = 1..31 */)
        {
            Debug.Assert(DayNumber >= 1 && DayNumber <= 31);

            int DayNumber10 = DayNumber % 10;

            if (DayNumber10 == 1) { if (DayNumber/*%100*/ != 11) return "st"; }
            else if (DayNumber10 == 2) { if (DayNumber/*%100*/ != 12) return "nd"; }
            else if (DayNumber10 == 3) { if (DayNumber/*%100*/ != 13) return "rd"; }

            return "th";
        }