C# Program to get current day of week

CsharpProgrammingServer Side Programming

Use DateTime. DayOfWeek property to display the current day of week.

DayOfWeek wk = DateTime.Today.DayOfWeek;

Now, displaying “wk” would give you the current day of the week.

Let us see the complete code to get the current day of week.

Example

 Live Demo

using System;
using System.Linq;
public class Demo {
   public static void Main() {
      DayOfWeek wk = DateTime.Today.DayOfWeek;
      Console.WriteLine(wk);
   }
}

Output

Wednesday
raja
Published on 12-Sep-2018 12:04:04
Advertisements