예제 #1
0
        } // IsSameQuarter

        // ----------------------------------------------------------------------
        public static bool IsSameQuarter(YearMonth yearStartMonth, DateTime left, DateTime right)
        {
            int leftYear  = TimeTool.GetYearOf(yearStartMonth, left);
            int rightYear = TimeTool.GetYearOf(yearStartMonth, right);

            if (leftYear != rightYear)
            {
                return(false);
            }

            return(TimeTool.GetQuarterOfMonth(yearStartMonth, (YearMonth)left.Month) == TimeTool.GetQuarterOfMonth(yearStartMonth, (YearMonth)right.Month));
        } // IsSameQuarter
예제 #2
0
        } // CalcYears

        // ----------------------------------------------------------------------
        private int CalcQuarters()
        {
            if (TimeCompare.IsSameMonth(date1, date2))
            {
                return(0);
            }

            int         year1    = TimeTool.GetYearOf(yearBaseMonth, Year1, Month1);
            YearQuarter quarter1 = TimeTool.GetQuarterOfMonth(yearBaseMonth, (YearMonth)Month1);

            int         year2    = TimeTool.GetYearOf(yearBaseMonth, Year2, Month2);
            YearQuarter quarter2 = TimeTool.GetQuarterOfMonth(yearBaseMonth, (YearMonth)Month2);

            return
                (((year2 * TimeSpec.QuartersPerYear) + quarter2) -
                 ((year1 * TimeSpec.QuartersPerYear) + quarter1));
        } // CalcQuarters
예제 #3
0
        } // IsSameYear

        // ----------------------------------------------------------------------
        public static bool IsSameYear(YearMonth yearStartMonth, DateTime left, DateTime right)
        {
            return(TimeTool.GetYearOf(yearStartMonth, left) == TimeTool.GetYearOf(yearStartMonth, right));
        } // IsSameYear
예제 #4
0
        } // Quarter

        // ----------------------------------------------------------------------
        public Quarter(DateTime moment, ITimeCalendar calendar) :
            this(TimeTool.GetYearOf(calendar.YearBaseMonth, calendar.GetYear(moment), calendar.GetMonth(moment)),
                 TimeTool.GetQuarterOfMonth(calendar.YearBaseMonth, (YearMonth)moment.Month), calendar)
        {
        } // Quarter
예제 #5
0
        } // Years

        // ----------------------------------------------------------------------
        public Years(DateTime moment, int count, ITimeCalendar calendar) :
            this(TimeTool.GetYearOf(calendar.YearBaseMonth, calendar.GetYear(moment), calendar.GetMonth(moment)),
                 count, calendar)
        {
        } // Years
예제 #6
0
        } // Halfyear

        // ----------------------------------------------------------------------
        public Halfyear(DateTime moment, ITimeCalendar calendar) :
            this(TimeTool.GetYearOf(calendar.YearBaseMonth, calendar.GetYear(moment), calendar.GetMonth(moment)),
                 TimeTool.GetHalfyearOfMonth(calendar.YearBaseMonth, (YearMonth)calendar.GetMonth(moment)), calendar)
        {
        } // Halfyear
예제 #7
0
        } // Halfyears

        // ----------------------------------------------------------------------
        public Halfyears(DateTime moment, YearHalfyear startHalfyear, int count, ITimeCalendar calendar) :
            this(TimeTool.GetYearOf(calendar.YearBaseMonth, calendar.GetYear(moment), calendar.GetMonth(moment)),
                 startHalfyear, count, calendar)
        {
        } // Halfyears
예제 #8
0
        } // Quarters

        // ----------------------------------------------------------------------
        public Quarters(DateTime moment, YearQuarter startYearQuarter, int count, ITimeCalendar calendar) :
            this(TimeTool.GetYearOf(calendar.YearBaseMonth, calendar.GetYear(moment), calendar.GetMonth(moment)),
                 startYearQuarter, count, calendar)
        {
        } // Quarters