Class TimeUtil

java.lang.Object
ca.spottedleaf.common.util.TimeUtil

public final class TimeUtil extends Object
  • Field Details

  • Method Details

    • compareTimes

      public static int compareTimes(long t1, long t2)
      This function is appropriate to be used as a Comparator between two timestamps, which indicates whether the timestamps represented by t1, t2 that t1 is before, equal to, or after t2.
    • isBefore

      public static boolean isBefore(long t1, long t2)
      Tests whether t1 is before t2.
    • isBeforeOrSame

      public static boolean isBeforeOrSame(long t1, long t2)
      Tests whether t1 is the same as or before t2.
    • isAfter

      public static boolean isAfter(long t1, long t2)
      Tests whether t1 is after t2.
    • isAfterOrSame

      public static boolean isAfterOrSame(long t1, long t2)
      Tests whether t1 is the same as or after t2.
    • getGreatestTime

      public static long getGreatestTime(long t1, long t2)
    • getLeastTime

      public static long getLeastTime(long t1, long t2)
    • clampTime

      public static long clampTime(long value, long min, long max)
    • parseEpochMilli

      public static ZonedDateTime parseEpochMilli(DateTimeFormatter format, String dateTime) throws DateTimeParseException
      Throws:
      DateTimeParseException
    • formatEpochMilli

      public static String formatEpochMilli(DateTimeFormatter format, long timeMS, ZoneId zoneId)
    • formatDateWithRelative

      public static String formatDateWithRelative(DateTimeFormatter format, long timeMS, ZoneId zoneId)
    • formatDateWithRelative

      public static String formatDateWithRelative(DateTimeFormatter format, long timeMS, ZoneId zoneId, ChronoUnit relativeMaxResolution)