/// <summary> /// Get last day of year for <paramref name="date"/> for year beginning on <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First day of year (Often fiscal)</param> /// <returns>Date of last day of year</returns> public static DateTime YearEnd(DateTime date, SNetMonth firstMonthOfYear) { DateTime yearBegin = YearBegin(date, firstMonthOfYear); return(YearEnd(date, yearBegin)); }
/// <summary> /// Return the calendar quarter for the current date for year starting in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="firstMonthOfYear">First of of year. (Often fiscal year)</param> /// <returns>Quarter number (1-4) for current date</returns> public static int Quarter(SNetMonth firstMonthOfYear) { return(Quarter(DateTime.Now, firstMonthOfYear)); }
/// <summary> /// Get first day of year for <paramref name="date"/> for year beginning on <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First Month of year (Often fiscal)</param> /// <returns>Date of first day of year</returns> public static DateTime YearBegin(DateTime date, SNetMonth firstMonthOfYear) { return(YearBegin(date, new DateTime(DateTime.MinValue.Year, monthToInt(firstMonthOfYear), 1))); }
/// <summary> /// Get last day of year for current datetime with year starting in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="firstMonthOfYear">last Month of year (Often fiscal)</param> /// <returns>Date of last day of year</returns> public static DateTime YearEnd(SNetMonth firstMonthOfYear) { return(YearEnd(DateTime.Now, firstMonthOfYear)); }
/// <summary> /// Returns the first date of current quarter for the current date for year beginning in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="firstMonthOfYear">First Month of year. (Often fiscal)</param> /// <returns>Date of first Month of year</returns> public static DateTime QuarterBegin(SNetMonth firstMonthOfYear) { return(QuarterBegin(DateTime.Now, firstMonthOfYear)); }
/// <summary> /// Get last date in quarter for year beginning on <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="quarter">Quarter to check</param> /// <param name="dateInYear">Random date in year that quarter will belong to. Used to determine correct returned year</param> /// <param name="firstMonthOfYear">First Month of year. (Often fiscal)</param> /// <returns>DateTime of last day in quarter</returns> public static DateTime QuarterEnd(int quarter, DateTime dateInYear, SNetMonth firstMonthOfYear) { return(QuarterEnd(quarter, dateInYear, new DateTime(DateTime.MinValue.Year, monthToInt(firstMonthOfYear), 1))); }
} //Quarter /// <summary> /// Return the calendar quarter for a specific date for year that begins on a specific month /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First Month of year. (Often fiscal year)</param> /// <returns>Quarter number (1-4) for current date</returns> public static int Quarter(DateTime date, SNetMonth firstMonthOfYear) { return Quarter(date, new DateTime(date.Year, monthToInt(firstMonthOfYear), 1)); }
} //QuarterEnd /// <summary> /// End of current quarter of <paramref name="date"/> for year starting in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First Month in year. (Often fiscal year)</param> /// <returns>Last date in quarter</returns> public static DateTime QuarterEnd(DateTime date, SNetMonth firstMonthOfYear) { return QuarterEnd(date, new DateTime(DateTime.MinValue.Year, monthToInt(firstMonthOfYear), 1)); }
/// <summary> /// Get last day of year for <paramref name="date"/> for year beginning on <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First day of year (Often fiscal)</param> /// <returns>Date of last day of year</returns> public static DateTime YearEnd(DateTime date, SNetMonth firstMonthOfYear) { DateTime yearBegin = YearBegin(date, firstMonthOfYear); return YearEnd(date, yearBegin); }
/// <summary> /// Return the calendar quarter for the current date for year starting in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="firstMonthOfYear">First of of year. (Often fiscal year)</param> /// <returns>Quarter number (1-4) for current date</returns> public static int Quarter(SNetMonth firstMonthOfYear) { return Quarter(DateTime.Now, firstMonthOfYear); }
/// <summary> /// Get last day of year for current datetime with year starting in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="firstMonthOfYear">last Month of year (Often fiscal)</param> /// <returns>Date of last day of year</returns> public static DateTime YearEnd(SNetMonth firstMonthOfYear) { return YearEnd(DateTime.Now, firstMonthOfYear); }
/// <summary> /// Get first day of year for <paramref name="date"/> for year beginning on <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First Month of year (Often fiscal)</param> /// <returns>Date of first day of year</returns> public static DateTime YearBegin(DateTime date, SNetMonth firstMonthOfYear) { return YearBegin(date, new DateTime(DateTime.MinValue.Year, monthToInt(firstMonthOfYear), 1)); }
/// <summary> /// Get last date in quarter for year beginning on <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="quarter">Quarter to check</param> /// <param name="dateInYear">Random date in year that quarter will belong to. Used to determine correct returned year</param> /// <param name="firstMonthOfYear">First Month of year. (Often fiscal)</param> /// <returns>DateTime of last day in quarter</returns> public static DateTime QuarterEnd(int quarter, DateTime dateInYear, SNetMonth firstMonthOfYear) { return QuarterEnd(quarter, dateInYear, new DateTime(DateTime.MinValue.Year, monthToInt(firstMonthOfYear), 1)); }
} //Quarter /// <summary> /// Return the calendar quarter for a specific date for year that begins on a specific month /// </summary> /// <param name="date">Date to check</param> /// <param name="firstMonthOfYear">First Month of year. (Often fiscal year)</param> /// <returns>Quarter number (1-4) for current date</returns> public static int Quarter(DateTime date, SNetMonth firstMonthOfYear) { return(Quarter(date, new DateTime(date.Year, monthToInt(firstMonthOfYear), 1))); }
private static int monthToInt(SNetMonth month) { return (int)month; }
private static int monthToInt(SNetMonth month) { return((int)month); }
/// <summary> /// Returns the first date of current quarter for the current date for year beginning in <paramref name="firstMonthOfYear"/> /// </summary> /// <param name="firstMonthOfYear">First Month of year. (Often fiscal)</param> /// <returns>Date of first Month of year</returns> public static DateTime QuarterBegin(SNetMonth firstMonthOfYear) { return QuarterBegin(DateTime.Now, firstMonthOfYear); }