How can relative time be calculated in C#?

Given a specific DateTime value, how do I display relative time, like:

  • 2 hours ago
  • 3 days ago
  • a month ago
Asked on April 6, 2016 in C#.
Add Comment
1 Answer(s)

Well, here’s how we do it on Stack Overflow.

Suggestions? Comments? Ways to improve this algorithm?

Answered on April 6, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.