I'm having a Java Date and I want to convert this to something like
0s ago or 38m ago.
I've searched for a build in function but I didn't find anything.
What's the best way to convert this?
I'm having a Java Date and I want to convert this to something like
0s ago or 38m ago.
I've searched for a build in function but I didn't find anything.
What's the best way to convert this?
First, dont use the ambiguous "Date" in java, use the new classes introduced in Java 8.
Now, if u have 2 LocalDateTime, (the date of the past event and "now"), you can evaluate the difference between and format it : Java 8: Calculate difference between two LocalDateTime
UPDATE : I have to say it's available for java 7 (and 6) only through the backport library : http://www.threeten.org/threetenbp/, standard only in java 8