如何只比较日期部分而不是两个日期的时间? [英] How to compare just the date part and not the time of two Dates?
本文介绍了如何只比较日期部分而不是两个日期的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想比较两个VB.NET Date对象的日期部分(而不是时间)。
有办法吗?
I want to compare just the date part (and Not the time) of two VB.NET Date objects. Is there a way to do that?
推荐答案
只需通过<$ c $取每个日期的日期部分c> Date 属性并比较两者:
Just take the date part of each via the Date
property and compare the two:
date1.Date.CompareTo(date2.Date)
或:
If date1.Date < date2.Date Then
这篇关于如何只比较日期部分而不是两个日期的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文