Get Last Start Of The Week - CSharp System

CSharp examples for System:DateTime Week

Description

Get Last Start Of The Week

Demo Code


using System.Globalization;
using System;//from   ww  w  .ja va2  s  .c  o m

public class Main{
        public static DateTime GetLastStartOfTheWeek(DateTime date, CultureInfo culture)
        {
            var firstDay = culture.DateTimeFormat.FirstDayOfWeek;

            return date.AddDays(-(date.DayOfWeek - firstDay)).Date;
        }
}

Related Tutorials