Harugawa Harugawa - 5 months ago 32
C# Question

Comparing datetimes in eval to hours

I've got a datetime and I want to check if there is 24 hours difference between those two. I just don't know how to do that.
So far I've got this:

<%# (DateTime.Now - Convert.ToDateTime(Eval("new_date"))) < 24 ? "Today" : Eval("new_date") %>

It does not work tho :<
And this is how datetime in my database looks like for example:

2016-09-18 12:26:14


The difference between 2 DateTimes is a TimeSpan, which has a TotalDays property you could compare to 1..