Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# DateTime - How to check Time part is NULL?

Tags:

c#

datetime

null

Is there any easy way to check to see if the time part of the DateTime value is NULL other than checking hour is 0, min is 0 and sec is 0?

Thanks.

like image 588
JKK Avatar asked Sep 09 '11 11:09

JKK


1 Answers

I find this very readable:

var isTimeNull = (myDateTime.TimeOfDay == TimeSpan.Zero);
like image 118
herzbube Avatar answered Oct 26 '22 23:10

herzbube