Using DateTime.ParseExact to get only the time (without the day)

前端 未结 3 1903
情歌与酒
情歌与酒 2021-01-18 02:14

I get unexpected results when I use DateTime.ParseExact. Here\'s my test code:

Dim MinVal As DateTime = #12:00:01 AM#
Dim MaxVal As DateTime = #11:59:59 PM#         


        
3条回答
  •  别那么骄傲
    2021-01-18 02:26

    use dt1.TimeOfDay and dt2.TimeOfDay for such comparisons... thus taking the day part out of the equation...

提交回复
热议问题