Question

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;
}
Was it helpful?

Solution

Why don't

if (dayofweektext.Contains("tomorrow"))
{
    dayofweektext = DateTime.Today.AddDays(1).DayOfWeek.ToString();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top