How to compare just the date part and not the time of two Dates?

后端 未结 6 1613
南旧
南旧 2020-12-29 21:30

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?

6条回答
  •  盖世英雄少女心
    2020-12-29 21:46

    Just take the date part of each via the Date property and compare the two:

    date1.Date.CompareTo(date2.Date)
    

    Or:

    If date1.Date < date2.Date Then
    

提交回复
热议问题