Package com.atlassian.bamboo.util
Class BambooDateUtils
java.lang.Object
com.atlassian.bamboo.util.BambooDateUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdateToPortableString(@NotNull Date date) static StringdateToPortableString(@NotNull Date date, @NotNull TimeZone timeZone) static @NotNull DatefromIsoTimestampString(@NotNull String dateString) static DurationgetDurationToNow(@NotNull Date dateToCompare) static longgetMillisDistanceToNow(@NotNull Date dateToCompare) static longgetMinutesDistanceToNow(@NotNull Date dateToCompare) static longgetSecondsDistanceToNow(@NotNull Date dateToCompare) static booleanisWithinDays(Date earlierDate, Date laterDate, long days) Returns whether the laterDate is not later than the number of "days" since the last earlierDatestatic booleanisWithinMillis(@Nullable Date date1, @Nullable Date date2, long millis) Returns true if the two given dates are within the given number of millis.static DatemakeReasonableDate(@NotNull Date date) Caps dates predating The Epoch to Epoch.static DateportableDateStringToDate(@NotNull String dateString) static @NotNull StringtoIsoTimestampString(@NotNull Date date) static StringtoSimpleTimestamp(@NotNull Date date)
-
Method Details
-
isWithinDays
Returns whether the laterDate is not later than the number of "days" since the last earlierDate- Parameters:
earlierDate- - must not be nulllaterDate- - must not be nulldays- - 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 nulldate2- - must not be nullmillis- - must be a positive long- Returns:
- true if dates are within the given number millis
-
toSimpleTimestamp
-
dateToPortableString
-
dateToPortableString
-
portableDateStringToDate
public static Date portableDateStringToDate(@NotNull @NotNull String dateString) throws ParseException - Throws:
ParseException
-
getMinutesDistanceToNow
-
getSecondsDistanceToNow
-
getMillisDistanceToNow
-
getDurationToNow
-
toIsoTimestampString
-
fromIsoTimestampString
-
makeReasonableDate
Caps dates predating The Epoch to Epoch.
-