如何计算一个月内的天数? [英] How to calculate Number of Days in a month?
本文介绍了如何计算一个月内的天数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经附加了一个月份和一年的下拉列表,基于我想要计算选定月份和年份的天数,考虑到跳跃(2月)年,所以请尽快给我解决方案
解决方案
这是一个非常困难的Google问题...
http://msdn.microsoft.com/en-us/library/system.datetime.daysinmonth(v=vs.110).aspx [ ^ ]
格式化您的下拉菜单,以便首先选择年份。
根据所选年份,您可以确定年份是否为闰年,如果(年%4 == 0)那么这是闰年!
I have attached one dropdownlist for month and one for year based on that i want to calculate no of days in selected month and year with consideration of leap(Feb) year so please give me solution for that ASAP
解决方案
It is a very hard Google problem...
http://msdn.microsoft.com/en-us/library/system.datetime.daysinmonth(v=vs.110).aspx[^]
Format your dropdowns so that the year is selected first.
Based on the year selected you can determine if the year is a leap year or not if(year%4 == 0) then it's a leap year!
这篇关于如何计算一个月内的天数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文