com.atlassian.bamboo.util
Class BambooDateUtils

java.lang.Object
  extended by com.atlassian.bamboo.util.BambooDateUtils

public class BambooDateUtils
extends Object


Method Summary
static String dateToPortableString(Date date)
           
static String dateToPortableString(Date date, TimeZone timeZone)
           
static Date fromIsoTimestampString(String dateString)
           
static long getMillisDistanceToNow(Date dateToCompare)
           
static long getMinutesDistanceToNow(Date dateToCompare)
           
static long getSecondsDistanceToNow(Date dateToCompare)
           
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
static boolean isWithinMillis(Date date1, Date date2, long millis)
          Returns true if the two given dates are within the given number of millis.
static Date makeReasonableDate(Date date)
          Caps dates predating The Epoch to Epoch.
static Date portableDateStringToDate(String dateString)
           
static String toIsoTimestampString(Date date)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
                                     Date date1,
                                     @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

dateToPortableString

public static String dateToPortableString(@NotNull
                                          Date date)

dateToPortableString

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

portableDateStringToDate

public static Date portableDateStringToDate(@NotNull
                                            String dateString)
                                     throws ParseException
Throws:
ParseException

getMinutesDistanceToNow

public static long getMinutesDistanceToNow(@NotNull
                                           Date dateToCompare)

getSecondsDistanceToNow

public static long getSecondsDistanceToNow(@NotNull
                                           Date dateToCompare)

getMillisDistanceToNow

public static long getMillisDistanceToNow(@NotNull
                                          Date dateToCompare)

toIsoTimestampString

@NotNull
public static String toIsoTimestampString(@NotNull
                                                  Date date)

fromIsoTimestampString

@NotNull
public static Date fromIsoTimestampString(@NotNull
                                                  String dateString)

makeReasonableDate

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



Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.