ncsa.tools.common.util
Class DateUtils

java.lang.Object
  extended byncsa.tools.common.util.DateUtils

public class DateUtils
extends java.lang.Object


Constructor Summary
DateUtils()
           
 
Method Summary
static int getDaysBetween(java.util.Calendar d1, java.util.Calendar d2)
          Calculates the number of days between two calendar days in a manner which is independent of the Calendar type used.
static double getMinutesBetween(java.util.Calendar d1, java.util.Calendar d2)
          Calculates the number of minutes between two dates in a manner which is independent of the Calendar type used.
static java.util.Date now()
           
static void setToTime(java.util.Calendar calendar, int hours, int minutes)
           
static java.util.Date setToTime(java.util.Date date, int hours, int minutes)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtils

public DateUtils()
Method Detail

now

public static java.util.Date now()

setToTime

public static java.util.Date setToTime(java.util.Date date,
                                       int hours,
                                       int minutes)

setToTime

public static void setToTime(java.util.Calendar calendar,
                             int hours,
                             int minutes)

getDaysBetween

public static int getDaysBetween(java.util.Calendar d1,
                                 java.util.Calendar d2)
Calculates the number of days between two calendar days in a manner which is independent of the Calendar type used.

Parameters:
d1 - The first date.
d2 - The second date.
Returns:
The number of days between the two dates. Zero is returned if the dates are the same, one if the dates are adjacent, etc. The order of the dates does not matter, the value returned is always >= 0. If Calendar types of d1 and d2 are different, the result may not be accurate.

getMinutesBetween

public static double getMinutesBetween(java.util.Calendar d1,
                                       java.util.Calendar d2)
Calculates the number of minutes between two dates in a manner which is independent of the Calendar type used.

Parameters:
d1 - The first date.
d2 - The second date.
Returns:
The number of minutes between the two dates. Zero is returned if the dates are the same, one if the dates are adjacent, etc. The order of the dates does not matter, the value returned is always >= 0. If Calendar types of d1 and d2 are different, the result may not be accurate.