w3resource

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

C# Sharp DateTime: Exercise-3 with Solution

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

Sample Solution:-

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);
    }
}

Sample Output:

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

Flowchart :

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

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: Write a C# Sharp program to display the Day properties (year, month, day, hour, minute, second, millisecond etc.).
Next: Write a C# Sharp program to display the number of days of the year between two specified years.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Share this Tutorial / Exercise on : Facebook and Twitter