Calculate the start-date and name of a quarter from a given date

Something like (untested):

DateTime date;
int quarterNumber = (date.Month-1)/3+1;
DateTime firstDayOfQuarter = new DateTime(date.Year, (quarterNumber-1)*3+1,1);
DateTime lastDayOfQuarter = firstDayOfQuarter.AddMonths(3).AddDays(-1);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)