Duplicate: This is one of the earliest question on StackOverflow posted by Jeff.
http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time
Does anyone know of a good library (or code snippet) for converting a TimeSpan object to a "friendly" string such as:
- Two years, three months and four days
- One week and two days
(It's for a document expiry system, where the expiry could be anything from a few days to several decades)
Just to clarify, say I had a TimeSpan with 7 days, that should print "1 week", 14 days "2 weeks", 366 days "1 year and 1 day", etc etc.