显示下一年并通过 [英] show following year and passed

查看:61
本文介绍了显示下一年并通过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉,我正在展示2006年3月31日和过去的5年,我需要

也显示下一年的月末,仍然显示已通过5 。


所以我需要12/31/2007并且从今天起5年后,我怎么能这样做?

I have a drop down where I''m showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?

推荐答案

你好CSharpguy - 如果我理解你的问题,我会认为

DateTime是你的朋友。您可以使用DateTime对象,然后调用

适当的方法.AddDays(),. AddMonths()或AddYears() - 添加否定

数字以向后移动。它会为你做所有日历的东西。

-

brians
http://www.limbertech.com

" CSharpguy"写道:
Hello CSharpguy - If I understand your question correctly, I would think that
DateTime is your friend. You can use a DateTime object and then call the
appropriate method .AddDays(), .AddMonths(), or AddYears() - add negative
numbers to go backwards. It will do all the all the calendar stuff for you.
--
brians
http://www.limbertech.com
"CSharpguy" wrote:
我有一个下拉,我正在展示2006年3月31日和过去的5年,我需要
也显示月结束以下今年仍然显示已通过的5。

所以我需要12/31/2007并且从今天起5年后,我该怎么做?
I have a drop down where I''m showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?



DateTime.AddYears(int value)方法怎么样?

您可以使用循环将变量年份作为参数传递给

此方法并将该日期添加到下拉列表中。传递一个负值

值,返回一年,正值将增加一年。

What about the DateTime.AddYears(int value) Method?

You can use a loop to to pass in a variable year as the parameter to
this method and add that date to the dropdown list. Passing a negative
value with go back a year, and a positive value will add a year.


你想玩使用system.DateTime类。例如


System.DateTime.Now.AddYears(1)将返回今天的DateTime对象

明年的日期


System.DateTime.Now.AddYears(-3)将从3年前返回一个DAtTime。


" CSharpguy"写道:
You want to play with the system.DateTime class. E.g.

System.DateTime.Now.AddYears(1) will return a DateTime object that is todays
date next year

System.DateTime.Now.AddYears(-3) will return a DAtTime from 3 years ago.

"CSharpguy" wrote:
我有一个下拉,我正在展示2006年3月31日和过去的5年,我需要
也显示月结束以下今年仍然显示已通过的5。

所以我需要12/31/2007并且从今天起5年后,我该怎么做?
I have a drop down where I''m showing 3/31/2006 and the passed 5 years, I need
to also show month end for the following year and still show the passed 5 .

So I need 12/31/2007 and back 5 years from today, how can I do this?



这篇关于显示下一年并通过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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