What is the best way to determine if a System.DateTime is midnight?

I’d check (using C# for the example):

bool isMidnight = value.TimeOfDay.Ticks == 0;

IMO, this is easier than using FromHours etc, and doesn’t involve any extra multiplication (since Ticks defined the TimeSpan – all the other properties are calculated).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)