Class AgeUtil
java.lang.Object
com.datdeveloper.datmoddingapi.util.AgeUtil
A utility class to help display time scales
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getFriendlyDifference
(long deltaTime) Get a friendly string representing the difference in time
For example, if the timestamp represents 3500 seconds, it would return "58 minutes" Supports seconds, minutes, hours, days, months, and yearsstatic String
getFriendlyRelativeTime
(long timeStamp) Get a friendly string representing the difference between now and the given timestamp
For example, if the timestamp represents 3500 seconds in the future, it would return "In 58 minutes", equally, if the timestamp represents 80000 seconds in the past, it would return "22 hours ago" Supports seconds, minutes, hours, days, months, and years
-
Method Details
-
getFriendlyDifference
Get a friendly string representing the difference in time
For example, if the timestamp represents 3500 seconds, it would return "58 minutes" Supports seconds, minutes, hours, days, months, and years- Parameters:
deltaTime
- The time period in milliseconds- Returns:
- A string representing the difference in time
-
getFriendlyRelativeTime
Get a friendly string representing the difference between now and the given timestamp
For example, if the timestamp represents 3500 seconds in the future, it would return "In 58 minutes", equally, if the timestamp represents 80000 seconds in the past, it would return "22 hours ago" Supports seconds, minutes, hours, days, months, and years- Parameters:
timeStamp
- The timestamp the message should be relative to- Returns:
- A string representing the difference in time
-