Hi,
I'm using the following and it's working fine:
string datum = System.DateTime.Today.AddDays(1).ToString("dd.MM.yyyy");
inputtagInfo.FindAdapter<InputTag>().PressKeys(datum);
But my testcase needs a day in a normal working week, no saturday or sunday. So I can't let this start on a friday
I would like to know the day of the week, so I could in case of friday just add 3 days.
I intented with DayofWeek, but it didn't work.
Someone an idea? I would appreciate, thanks
Best,
Karin
How to get Day of Week
Re: How to get Day of Week
You could do this:
Notice where I replaced "1" with "System.DateTime.Today.DayOfWeek == DayOfWeek.Friday ? 3 : 1". This says "if Today is Friday, return 3, if not, return 1".
Code: Select all
string datum = System.DateTime.Today.AddDays((System.DateTime.Today.DayOfWeek == DayOfWeek.Friday ? 3 : 1)).ToString("dd.MM.yyyy");
Shortcuts usually aren't...
Re: How to get Day of Week
It works absolutely great!!
Thanks
Thanks