2018年4月19日 星期四

[C#] 判斷星期幾

星期一 ~ 星期日

var today = DateTime.Now;


if (today.DayOfWeek == DayOfWeek.Monday)

if (today.DayOfWeek == DayOfWeek.Tuesday)

if (today.DayOfWeek == DayOfWeek.Wednesday)

if (today.DayOfWeek == DayOfWeek.Thursday)

if (today.DayOfWeek == DayOfWeek.Friday)

if (today.DayOfWeek == DayOfWeek.Saturday)

if (today.DayOfWeek == DayOfWeek.Sunday)

...

沒有留言:

張貼留言