Search code examples
c#dayofweek

C# Set String To Current Date +1


I have a string called "dayofweektext".

What I need to do is change the value of this to the current date, plus one day. IE: If the user inputs "tomorrow", I want to use something like (DayOfWeek day) +1 to set "dayofweektext" to tomorrows day name.

This is what I have currently, but it isn't working and I haven't used the (DayOfWeek) successfully before:

if (dayofweektext.Contains("tomorrow"))
{
   dayofweektext = (DayOfWeek day) + 1;
}

Solution

  • Why don't

    if (dayofweektext.Contains("tomorrow"))
    {
        dayofweektext = DateTime.Today.AddDays(1).DayOfWeek.ToString();
    }