w3resource logo


C# Sharp Programming Exercises

C# Sharp Exercises: Day of the week for a specified date

Secondary Nav

C# Sharp DateTime : Exercise-3 with Solution

Write a C# Sharp program to get the day of the week for a specified date.

Expected Output :

The day of the week for 7/11/2016 is Monday.   

C# Sharp Code:

using System;

public  class Example3 
{
    public static void Main() 
    {
// Assume the current system  is en-US.
    DateTime dt = new DateTime(2016, 7, 11);
    Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek);
    }
}

C# Sharp Practice online:

using System;

public  class Example3 
{
    public static void Main() 
    {
// Assume the current system  is en-US.
    DateTime dt = new DateTime(2016, 7, 11);
    Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek);
    }
}

Improve this sample solution and post your code through Disqus.



Join our Question Answer community to learn and share your programming knowledge.

Solve these problems:

Python: How to check whether a file exists using Python?

C#: Loops in c#

PHP: For each

SQL: JOIN using more than 5 tables

JavaScript: Blank Slide in Javascript Slideshow