BB.Caching.Redis.Analytics.BitwiseAnalytics.DateTimeUtil.DaysInWeek C# (CSharp) Method

DaysInWeek() private method

private DaysInWeek ( System.DateTime dateTime, DayOfWeek firstDayOfWeek = DayOfWeek.Sunday ) : string[]
dateTime System.DateTime
firstDayOfWeek DayOfWeek
return string[]
            public static string[] DaysInWeek(DateTime dateTime, DayOfWeek firstDayOfWeek = DayOfWeek.Sunday)
            {
                int difference = dateTime.DayOfWeek - firstDayOfWeek;
                if (difference < 0)
                {
                    difference += 7;
                }

                var tmp = dateTime.AddDays(-difference);
                return new[]
                           {
                               string.Format("{0:yyyyMMdd}", tmp),
                               string.Format("{0:yyyyMMdd}", tmp.AddDays(1)),
                               string.Format("{0:yyyyMMdd}", tmp.AddDays(2)),
                               string.Format("{0:yyyyMMdd}", tmp.AddDays(3)),
                               string.Format("{0:yyyyMMdd}", tmp.AddDays(4)),
                               string.Format("{0:yyyyMMdd}", tmp.AddDays(5)),
                               string.Format("{0:yyyyMMdd}", tmp.AddDays(6))
                           };
            }