Class AgeUtil

java.lang.Object
com.datdeveloper.datmoddingapi.util.AgeUtil

public class AgeUtil extends Object
A utility class to help display time scales
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 years
    static 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getFriendlyDifference

      public static 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 years
      Parameters:
      deltaTime - The time period in milliseconds
      Returns:
      A string representing the difference in time
    • getFriendlyRelativeTime

      public static 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
      Parameters:
      timeStamp - The timestamp the message should be relative to
      Returns:
      A string representing the difference in time