/// <summary> /// <paramref name="moment"/>이 속하면서, <paramref name="periodKind"/>에 해당하는 <see cref="ITimePeriod"/>을 반환합니다. /// </summary> /// <param name="moment"></param> /// <param name="periodKind"></param> /// <param name="timeCalendar"></param> /// <returns></returns> /// <seealso cref="GetPeriodsOf(System.DateTime,NFramework.TimePeriods.PeriodKind,int,NFramework.TimePeriods.ITimeCalendar)"/> public static ITimePeriod GetPeriodOf(this DateTime moment, PeriodKind periodKind, ITimeCalendar timeCalendar) { if (IsDebugEnabled) { log.Debug("날짜[{0}]가 속한 기간종류[{1}]의 기간을 구합니다. timeCalendar=[{2}]", moment.ToSortableString(), periodKind, timeCalendar); } timeCalendar = timeCalendar ?? TimeCalendar.New(); switch (periodKind) { case PeriodKind.Year: return(GetYearRange(moment, timeCalendar)); case PeriodKind.Halfyear: return(GetHalfyearRange(moment, timeCalendar)); case PeriodKind.Quarter: return(GetQuarterRange(moment, timeCalendar)); // return new QuarterRange(moment, timeCalendar); case PeriodKind.Month: return(GetMonthRange(moment, timeCalendar)); case PeriodKind.Week: return(GetWeekRange(moment, timeCalendar)); case PeriodKind.Day: return(GetDayRange(moment, timeCalendar)); case PeriodKind.Hour: return(GetHourRange(moment, timeCalendar)); case PeriodKind.Minute: return(GetMinuteRange(moment, timeCalendar)); case PeriodKind.Second: return(new TimeRange(moment.TrimToMillisecond(), DurationUtil.Second)); default: throw new NotSupportedException("지원하지 않는 TimePeriod 종류입니다. periodKind=" + periodKind); } }
/// <summary> /// <paramref name="moment"/>가 속한 하루서부터 <paramref name="minuteCount"/>만큼의 분의 기간 /// </summary> public static MinuteRangeCollection GetMinuteRanges(this DateTime moment, int minuteCount, ITimeCalendar timeCalendar = null) { return(new MinuteRangeCollection(moment, minuteCount, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 분의 기간을 반환합니다 (1분) /// </summary> public static MinuteRange GetMinuteRange(this DateTime moment, ITimeCalendar timeCalendar = null) { return(new MinuteRange(moment, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 하루서부터 <paramref name="hourCount"/>만큼의 시간의 기간 /// </summary> public static HourRangeCollection GetHourRanges(this DateTime moment, int hourCount, ITimeCalendar timeCalendar = null) { return(new HourRangeCollection(moment, hourCount, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 시간의 기간을 반환합니다 (1시간) /// </summary> public static HourRange GetHourRange(this DateTime moment, ITimeCalendar timeCalendar = null) { return(new HourRange(moment, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 하루서부터 <paramref name="dayCount"/>만큼의 일자의 기간 /// </summary> public static DayRangeCollection GetDayRanges(this DateTime moment, int dayCount, ITimeCalendar timeCalendar = null) { return(new DayRangeCollection(moment, dayCount, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 주에서 <paramref name="weekCount"/>만큼의 주의 기간 /// </summary> public static WeekRangeCollection GetWeekRanges(this DateTime moment, int weekCount, ITimeCalendar timeCalendar = null) { return(new WeekRangeCollection(moment, weekCount, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 분기부터 <paramref name="quarterCount"/> 갯수의 분기까지의 기간 /// </summary> /// <param name="moment">기준 일자</param> /// <param name="quarterCount">분기 수</param> /// <param name="timeCalendar">기준 TimeCalendar</param> public static QuarterRangeCollection GetQuarterRanges(this DateTime moment, int quarterCount, ITimeCalendar timeCalendar = null) { return(new QuarterRangeCollection(moment, quarterCount, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>가 속한 년과 <paramref name="yearCount"/> 만큼의 기간 /// </summary> public static YearRangeCollection GetYearRanges(this DateTime moment, int yearCount, ITimeCalendar timeCalendar = null) { return(new YearRangeCollection(moment, yearCount, timeCalendar ?? TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>이 속하면서, <paramref name="periodKind"/>에 해당하는 <see cref="ICalendarTimeRange"/>을 구합니다. /// </summary> /// <param name="moment"></param> /// <param name="periodKind"></param> /// <param name="periodCount"></param> /// <returns></returns> public static ICalendarTimeRange GetPeriodsOf(this DateTime moment, PeriodKind periodKind, int periodCount) { return(GetPeriodsOf(moment, periodKind, periodCount, TimeCalendar.New())); }
/// <summary> /// <paramref name="moment"/>이 속하면서, <paramref name="periodKind"/>에 해당하는 <see cref="ITimePeriod"/>을 구합니다. /// </summary> /// <param name="moment"></param> /// <param name="periodKind"></param> /// <returns></returns> public static ITimePeriod GetPeriodOf(this DateTime moment, PeriodKind periodKind) { return(GetPeriodOf(moment, periodKind, TimeCalendar.New())); }