如何找到日期之间的差异。 [英] How to find the difference between the date.
本文介绍了如何找到日期之间的差异。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DateTime dob = new DateTime();
dob = DateTime.Parse(txtdob.Text,Cul,System.Globalization.DateTimeStyles.NoCurrentDateDefault);
DateTime doa = new DateTime();
doa = DateTime.Parse(txtdoa.Text,Cul,System.Globalization.DateTimeStyles.NoCurrentDateDefault);
解决方案
一个方法是使用减去 [ ^ ]方法。
例如
dob.Subtract(doa)
整数ts
ts = DateDiff(DateInterval.Day,doa,dob);
我希望有帮助......
如何计算C#中文本框中两个日期之间的差异。 [ ^ ]
和 Google [< a href =http://www.lmgtfy.com/?q=difference+between+dates+C%23target =_ blanktitle =New Window> ^ ]是你最好的朋友。
在此之前,您可以查看发布指南的问题 [ ^
DateTime dob = new DateTime(); dob = DateTime.Parse(txtdob.Text, Cul, System.Globalization.DateTimeStyles.NoCurrentDateDefault); DateTime doa = new DateTime(); doa = DateTime.Parse(txtdoa.Text, Cul, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
解决方案
One way is to use Subtract[^] method.
For example
dob.Subtract(doa)
Integer ts ts = DateDiff(DateInterval.Day, doa, dob) ;
I hope that helps ...
How to calculate difference between two dates in textboxes in C#.[^]
and Google[^] is your best friend.
And before that have you check the question posting guidelines[^]
这篇关于如何找到日期之间的差异。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文