Find a Day after a number of days using C#

In one of my recent projects, I need a day name after a number of days. Here is the code snippet.

This code snippet finds and displays a day after a number of days. You can use this method and pass the number of days. The result will be the day name after that many days from today.

private void FindADayAfterDays(int days)
{
    DateTime aDay = DateTime.Now;
    TimeSpan week = new System.TimeSpan(days, 0, 0, 0);
    DateTime aDayAfterWeek = aDay.Add(week);
    Console.WriteLine("{0:dddd}", aDayAfterWeek);
}



Ebook Download
View all
Learn
View all