Get Monday This Week - CSharp System

CSharp examples for System:DateTime Week

Description

Get Monday This Week

Demo Code


using System;// ww  w . j ava 2  s .com

public class Main{
        public static DateTime GetMondayThisWeek()
        {
            int substract = (1 - (int)DateTime.Now.DayOfWeek);
            DateTime dt = DateTime.Now.AddDays(substract);
            return new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0);
        }
}

Related Tutorials