I receive a specific datetime value from my MySQL Database, and I want to convert it into formats like:
a while ago
2 hours ago
3 days ago
a month ago
it's been years (for above 2 year)
I am using PHP for this web service, this is a iOS app, but as I will send the JSON string to device. Should I convert the format in API itself or at device's end. and I am having to do it manually, Is there any sort of shortcut for this.
I have thought of using the if-else ladder logic, but it seems pretty mechanical. Any idea of any other 3rd party API.