Given a specific DateTime
value, how do I display relative time, like:
@Jeff
var ts = new TimeSpan(DateTime.UtcNow.Ticks - dt.Ticks);
Doing a subtraction on DateTime
returns a TimeSpan
anyway.
So you can just do
(DateTime.UtcNow - dt).TotalSeconds
I'm also surprised to see the constants multiplied-out by hand and then comments added with the multiplications in. Was that some misguided optimisation?