Example #1
0
 public CPGDate( DateTime dt )
 {
     m_etType = EType.Single;
     m_ecCalendar = ECalendar.Gregorian;
     m_year = new CYear( dt.Year );
     m_uMonth = (uint)dt.Month;
     m_uDay = (uint)dt.Day;
     m_yearTo = null;
     m_uMonthTo = 0;
     m_uDayTo = 0;
     m_sPhrase = "";
 }
Example #2
0
        // Copy constructor
        public CPGDate( CPGDate date )
        {
            m_etType = date.m_etType;
            m_ecCalendar = date.m_ecCalendar;
            if( date.m_year != null )
                m_year = new CYear( date.m_year );
            else
                m_year = null;
            m_uMonth = date.m_uMonth;
            m_uDay = date.m_uDay;
            if( date.m_yearTo != null )
                m_yearTo = new CYear( date.m_yearTo );
            else
                m_yearTo = null;

            m_uMonthTo = date.m_uMonthTo;
            m_uDayTo = date.m_uDayTo;
            m_sPhrase = date.m_sPhrase;
        }
Example #3
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;
        }
Example #4
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;
        }
Example #5
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;
        }
Example #6
0
 // Constructor
 public CYear( CYear year )
 {
     m_nYear = year.m_nYear;
     m_nYearAlt = year.m_nYearAlt;
     m_bAltValid = year.m_bAltValid;
 }