Class BambooDateUtils


  • public class BambooDateUtils
    extends Object
    • Method Detail

      • isWithinDays

        public static boolean isWithinDays​(Date earlierDate,
                                           Date laterDate,
                                           long days)
        Returns whether the laterDate is not later than the number of "days" since the last earlierDate
        Parameters:
        earlierDate - - must not be null
        laterDate - - must not be null
        days - - must be a positive integer
        Returns:
        true if within the number days specified
      • isWithinMillis

        public static boolean isWithinMillis​(@Nullable
                                             @Nullable Date date1,
                                             @Nullable
                                             @Nullable Date date2,
                                             long millis)
        Returns true if the two given dates are within the given number of millis. If either of the passed dates is null then it returns false;
        Parameters:
        date1 - - must not be null
        date2 - - must not be null
        millis - - must be a positive long
        Returns:
        true if dates are within the given number millis
      • toSimpleTimestamp

        public static String toSimpleTimestamp​(@NotNull
                                               @NotNull Date date)
      • dateToPortableString

        public static String dateToPortableString​(@NotNull
                                                  @NotNull Date date)
      • dateToPortableString

        public static String dateToPortableString​(@NotNull
                                                  @NotNull Date date,
                                                  @NotNull
                                                  @NotNull TimeZone timeZone)
      • getMinutesDistanceToNow

        public static long getMinutesDistanceToNow​(@NotNull
                                                   @NotNull Date dateToCompare)
      • getSecondsDistanceToNow

        public static long getSecondsDistanceToNow​(@NotNull
                                                   @NotNull Date dateToCompare)
      • getMillisDistanceToNow

        public static long getMillisDistanceToNow​(@NotNull
                                                  @NotNull Date dateToCompare)
      • getDurationToNow

        public static Duration getDurationToNow​(@NotNull
                                                @NotNull Date dateToCompare)
      • toIsoTimestampString

        @NotNull
        public static @NotNull String toIsoTimestampString​(@NotNull
                                                           @NotNull Date date)
      • fromIsoTimestampString

        @NotNull
        public static @NotNull Date fromIsoTimestampString​(@NotNull
                                                           @NotNull String dateString)
      • makeReasonableDate

        public static Date makeReasonableDate​(@NotNull
                                              @NotNull Date date)
        Caps dates predating The Epoch to Epoch.