Tuesday, May 28, 2019

get all period ending dates from the beginning of the year to end date


//get all period ending dates from the beginning of the year to end date
                    var endDate = productivitySearchDto.ToDate;
                    var dates = Enumerable.Range(1, endDate.DayOfYear)
                        .Select(n => new DateTime(endDate.Year,1,1).AddDays(n))
                        .Where(date => date.DayOfWeek == DayOfWeek.Saturday)
                        .ToList();

No comments:

Post a Comment