fork(4) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static int Weekday(DateTime dt, DayOfWeek startOfWeek)
  6. {
  7. return (dt.DayOfWeek - startOfWeek + 7) % 7;
  8. }
  9.  
  10.  
  11. public static void Main()
  12. {
  13. DateTime value = new DateTime(2012, 8, 20);
  14. DayOfWeek weekday = (DayOfWeek)Weekday(value, DateTime.Now.DayOfWeek);
  15.  
  16. Console.Write("normally:{0} changed to:{1}",value.DayOfWeek, weekday);
  17. }
  18. }
Success #stdin #stdout 0.03s 36992KB
stdin
Standard input is empty
stdout
normally:Monday changed to:Saturday