如何在Windows应用程序中计算日期差 [英] how to calculate date difference in windows application
本文介绍了如何在Windows应用程序中计算日期差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个Windows窗体中的两个datetimepicker.如果我以第一种形式在datetimepicker中选择日期,第二种形式的第二个datetimepicker在日期之后显示6个月的日期在第一种形式的datetimepicker中选择日期.它显示6个月的差异.我该怎么做?
i have two datetimepicker in two windows form. if i select date in datetimepicker in first form the second datetimepicker in second form display 6 month date after date select in datetimepicker in first form.it display 6 month differnce. how can i do that?
推荐答案
您需要在第一个选择器的日期前添加6个月.您可以执行以下任一方法.
以下内容将为您提供帮助:
MSDN:DateTime.AddMonths方法 [ MSDN:DateTime.Add方法 [ MSDN:时间跨度结构 [
You need to add 6 months to the date of first picker. You can do either way mentioned below.
Following would help you:
MSDN: DateTime.AddMonths Method [^]
OR
MSDN: DateTime.Add Method [^]
MSDN: TimeSpan Structure[^]
这篇关于如何在Windows应用程序中计算日期差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文