Finding current weekday of the week using Server.Time
Created at 13 Sep 2014, 16:29
Finding current weekday of the week using Server.Time
13 Sep 2014, 16:29
I've been working with some specific dates and times for an algorithm and now I need to know which weekday it is when the bot is running.
Currently I am using this:
string day_0 = Server.Time.AddDays(0).ToString("dd-MM-yyyy");
To find the date of the current day.
Is there a way to output the current weekday instead? eg. Monday, Tuesday or Wednesday and so on?
Best Regards
Flannery
Balena
13 Sep 2014, 23:52
you can use/modify these...
//if (Server.Time.DayOfWeek == DayOfWeek.Sunday && Server.Time > stopTime)
//return;
//if (Server.Time.DayOfWeek == DayOfWeek.Monday && Server.Time > stopTime)
//return;
//if (Server.Time.DayOfWeek == DayOfWeek.Tuesday && Server.Time > stopTime)
//return;
//if (Server.Time.DayOfWeek == DayOfWeek.Wednesday && Server.Time > stopTime)
//return;
//if (Server.Time.DayOfWeek == DayOfWeek.Thursday && Server.Time > stopTime)
//return;
if (Server.Time.DayOfWeek == DayOfWeek.Friday && Server.Time > resetTime.AddSeconds(ySeconds))
return;
if (Server.Time.DayOfWeek == DayOfWeek.Saturday)
return;
@Balena