本文介绍了系统常数为一周内的天数(7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以在.NET框架中找到一个定义一周中的天数的常量(7)?
Can anyone find a constant in the .NET framework that defines the number of days in a week (7)?
DateTime.DaysInAWeek // Something like this???
当然我可以定义自己的,但是我宁愿不在那里。
Of course I can define my own, but I'd rather not if it's somewhere in there already.
我正在寻找这个,因为我需要允许用户选择一个星期日期,而不是周数)从DropDownList的列表中。
I am looking for this because I need to allow the user to select a week (by date, rather than week number) from a list in a DropDownList.
推荐答案
你可能会使用 .Length。
You could probably use System.Globalization.DateTimeFormatInfo.CurrentInfo.DayNames.Length.
这篇关于系统常数为一周内的天数(7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!