コード例 #1
0
        // Returns this date as a French string. Used by DateString().
        private string DateStringFren( uint uDay, uint uMonth, CYear year )
        {
            string sDate = "";

            string[] aMonths = { "Vend", "Brum", "Frim", "Nivo", "Pluv", "Vent", "Germ", "Flor", "Prai", "Mess", "Ther", "Fruc", "Comp" };

            if( uDay != 0 )
            {
                sDate = uDay.ToString();
                uint ord = uDay % 10;
                if (ord == 1)
                {
                    sDate += "er";
                }
                else
                {
                    sDate += "me";
                }
                sDate += " ";
            }

            if( uMonth > 0 && uMonth <= aMonths.Length )
            {
                sDate += aMonths[uMonth-1];
                sDate += " ";
            }

            sDate += year.ToString();

            return sDate;
        }
コード例 #2
0
        // Returns this date as a Hebrew string. Used by DateString().
        private string DateStringHebr( uint uDay, uint uMonth, CYear year )
        {
            string sDate = "";

            string[] aMonths = { "Tsh", "Csh", "Ksl", "Tvt", "Shv", "Adr", "Ads", "Nsn", "Iyr", "Svn", "Tmz", "Aav", "Ell" };

            if( uDay != 0 )
            {
                sDate = uDay.ToString();
                sDate += " ";
            }

            if( uMonth > 0 && uMonth <= aMonths.Length )
            {
                sDate += aMonths[uMonth-1];
                sDate += " ";
            }

            sDate += year.ToString();

            return sDate;
        }
コード例 #3
0
        // Return this date as a displayable string. Used by ToString().
        private string DateString( uint uDay, uint uMonth, CYear year, ECalendar calendar )
        {
            if (year == null)
            {
                return "";
            }

            if (calendar == ECalendar.French)
            {
                return DateStringFren(uDay, uMonth, year);
            }
            if (calendar == ECalendar.Hebrew)
            {
                return DateStringHebr(uDay, uMonth, year);
            }

            string sDate = "";

            string[] aMonths = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

            if( uDay != 0 )
            {
                sDate = uDay.ToString();
                uint ord = uDay % 10;
                uint ord10 = uDay % 100;
                if( ord == 1 && ord10 != 11 )
                    sDate += "st";
                else if( ord == 2 && ord10 != 12 )
                    sDate += "nd";
                else if( ord == 3 && ord10 != 13 )
                    sDate += "rd";
                else
                    sDate += "th";
                sDate += " ";
            }

            if( uMonth > 0 && uMonth <= aMonths.Length )
            {
                sDate += aMonths[uMonth-1];
                sDate += " ";
            }

            sDate += year.ToString();

            return sDate;
        }