今天比较日期时间相匹配(第一,第二,第三,第四,第五)工作日(周一,周二等。)当月 [英] Compare today datetime to match (First, second, third, fourth, fifth) weekday(mon, tuesday ect.) of current month

查看:139
本文介绍了今天比较日期时间相匹配(第一,第二,第三,第四,第五)工作日(周一,周二等。)当月的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有内置的功能在C#中比较比较今天的日期时间相匹配,如:(第一,第二,第三,第四,第五)平日当月(星期一,星期二等)

Is There any built in function in c# to compare Compare today's datetime to match like: (First, second, third, fourth, fifth) weekday(mon, tuesday ect.) of current month

或任何一个可以请提供相同的定制解决方案。

or can any one please provide the custom solution for the same.

问候

推荐答案

您可以使用

DateTime.Now.DayOfWeek 

要获取一周中的当前日:

To fetch the current day of week:

DayOfWeek dToday = DateTime.Now.DayOfWeek;
int iDay = dToday.GetHashCode(); // a number between 0-6 representing 
                                 // the days in the week
string sDayName = dToday.ToString(); // can be either Sunday, Monday .. Satruday

这篇关于今天比较日期时间相匹配(第一,第二,第三,第四,第五)工作日(周一,周二等。)当月的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆