How to get a pretty date in c#

2 Kicks, 65 Views

Have you ever wondered how some sites were able to show the bottom of each post, a formatted date (pretty date) which estimates the number of days, months or years between the publication of the post and today? e.g. "posted 5 weeks ago"
This snippet will allow you to do this easily!
You can improve this code by adding, for example, a dictionary of resources for the different languages ​​of your application or website.