Get Date End Week - CSharp System

CSharp examples for System:DateTime Week

Description

Get Date End 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  w w.  ja  v  a 2s  .  c om*/

public class Main{
        public static DateTime GetDateEndWeek(DateTime date, int p = 6)
        {
            DateTime dateEnd = date.AddDays(p - date.DayOfWeek.GetHashCode());
            return dateEnd;
        }
}

Related Tutorials