一年零一个月后如何计算 [英] how to calculate after one year and month
本文介绍了一年零一个月后如何计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将从年份和月份中选择两个下拉列表.如何在12个月和年份后自动存储在接下来的两个下拉列表中..........
i will choose from year and month in two drop down list.how to automatically store after 12 months and year in my next two dropdown lists..........
推荐答案
查看结构System.DateTime
, http://msdn. microsoft.com/en-us/library/system.datetime.aspx [
Look at the structureSystem.DateTime
, http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^]. If you still cannot figure out how to solve your problem, ask a question, but this time formulate it clearly.
—SA
最好的方法是将年和月转换为DateTime:
Best way is to convert the Year and Month into a DateTime:
DateTime dt = new DateTime(myYear, myMon, 1)
dt = dt.AddYears(1)
MyOutputYearDropDown.SelectedValue = dt.Year.ToString()
MyOutputMonthDropDown.SelectedValue = dt.Month.ToString()
这样,如果您更改为一年零一个月或六个月的飞蛾,则可以清楚地知道自己在做什么.
That way, if you change to one year and a month, or six moths, it is clearer what you are doing.
这篇关于一年零一个月后如何计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文