user1031034
user1031034

Reputation: 856

Compare two date

I need compare two date. One is from databese, second is from now.

var dat = DateTime.Now;  
var bd = (from d in.... 
if (bd != dat)

Date (bd) in database is type "date" so have only data. Date from now (dat) get data with hours so if (bd != dat) cannot compare properly.

Upvotes: 1

Views: 593

Answers (1)

Daniel Casserly
Daniel Casserly

Reputation: 3543

You need to use DateTime.Today which will strip out hours.

Upvotes: 3

Related Questions