Monday Of Week - CSharp System

CSharp examples for System:DateTime Day

Description

Monday Of Week

Demo Code


using System.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Globalization;
using System;// w  w  w  .j av  a2  s .  com

public class Main{
  public static DateTime MondayOfWeek(this DateTime dt)
  {
    return (dt.AddDays(-1 * (dt.DayOfWeek - DayOfWeek.Monday)));
  }
}

Related Tutorials