Loading, please wait...

A to Z Full Forms and Acronyms

C Sharp Program to Get Day Of The Week After Some Days

In this blog we create a program which show the week name after the specific days. In this program we take input from user in number of days and then show the date and week day name by adding that days in current date.

C Sharp Program to Get Day Of The Week After Some Days 

Introduction

In this blog we create a program which show the week name after the specific days. In this program we take input from user in number of days and then show the date and week day name by adding that days in current date.

Code

using System;

namespace DayOfTheWeek
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("\t Program to get Day Of the Week After Specified Days");
            Console.WriteLine("\t ==================================================================");
            Console.Write("\t Enter Days After Today : ");
            int days=Convert.ToInt32( Console.ReadLine());
            DateTime date = DateTime.Now.AddDays(days);
            Console.WriteLine("\t Current Date : " + DateTime.Now.ToString("MM/dd/yyyy"));
            Console.WriteLine("\t Date After {0} Days : {1}", days, date.ToString("MM/dd/yyyy"));
            Console.WriteLine("\t Day Of The Week On {0} : {1}", date.ToString("MM/dd/yyyy"), date.DayOfWeek);
            Console.ReadKey();
        }
    }
}

 

Output

C Sharp Program to Get Day Of The Week After Some Days - YogeshHadiya.in

 

 
C Sharp Program to Get Day Of The Week After Some Days - YogeshHadiya.in

Explanation

  • In above code first we take input from user and convert that input I integer.
  • Then we add that number of days in current date by AddDays method of DateTime data type.
  • Then we print current date and date after those days. For day of the week, we use DayOfWeek property of DateTime object.

View Other program of C Sharps

A to Z Full Forms and Acronyms

Related Article