Here's a simple method for determining the first and last day of an arbitrary time period. For example, have you ever needed to get the first and last date of "last quarter", or "next month"? This method returns a simple structure with those dates. Simply pass the method a date in time, like today, and the date type you'd like to retrieve. For example, if you want the first date and last date for next quarter, you'd make a DateTime variable and assign it today's date plus 3 months (to create a date that occurs some time in the next quarter), and then pass that along with DateRangeOptions.Quarter to the method. The method will return a structure with the first and last date of that quarter.
Read More »