使用C#从日期时间获取的一天
问题描述:
愚蠢的问题。鉴于日期时间日期和我知道这是周二比如我怎么知道它的星期二= 2和MON = 1等等...
Silly question. Given a date in a datetime and I know it's tuesday for instance how do i know its tue=2 and mon=1 etc...
感谢
答
您正在寻找的 DAYOFWEEK 物业买卖资讯
之后,丹建议在下面的评论,只是看在枚举的整数值,以获得一天的整数:
You are looking for the DayOfWeek property.
Then, as Dan suggests in the comment below, just look at the integer value of the enum to get the day as integer:
int d = (int)System.DateTime.Now.DayOfWeek