当前位置:网站首页>C week processing

C week processing

2020-11-10 18:13:39 osc_60940048

C# Use an enumeration DayOfWeek Means week

 

1. Get the current day of the week

 DayOfWeek dfw = DateTime.Now.DayOfWeek;

2. Gets the numeric representation of the current week , Can convert directly 0( Sunday ) - 6( Saturday )

Convert.ToInt32(DateTime.Now.DayOfWeek)

3. Based on the above method , Count last Thursday ( Calculate this Monday ) Re reduction (3 God )

// Count last Thursday 
DateTime dt = DateTime.Now.AddDays(0 - Convert.ToInt32(DateTime.Now.DayOfWeek) - 3);

 

版权声明
本文为[osc_60940048]所创,转载请带上原文链接,感谢