Get Date Start Week - CSharp System

CSharp examples for System:DateTime Week

Description

Get Date Start Week

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Linq;
using System.Collections.Generic;
using System;//from w  ww . j a v  a 2 s  .com

public class Main{
        public static DateTime GetDateStartWeek(DateTime date, int p = 0)
        {
            DateTime dateStart = date.AddDays(p - date.DayOfWeek.GetHashCode());
            return dateStart;
        }
}

Related Tutorials