org.rapla.components.util
Class DateTools

java.lang.Object
  extended by org.rapla.components.util.DateTools

public abstract class DateTools
extends Object

Tools for manipulating dates. At the moment of writing rapla internaly stores all appointments in the GMT timezone.


Field Summary
static int DAYS_PER_WEEK
           
static TimeZone GMT
           
static long MILLISECONDS_PER_DAY
           
static long MILLISECONDS_PER_HOUR
           
static long MILLISECONDS_PER_MINUTE
           
static long MILLISECONDS_PER_WEEK
           
 
Constructor Summary
DateTools()
           
 
Method Summary
static Date addDay(Date date)
          Monday 24:00 = tuesday 0:00.
static Date addDays(Date date, int days)
          see #addDay
static long countDays(Date start, Date end)
           
static Calendar createGMTCalendar()
           
static void cutDate(Calendar calendar)
          sets time of day to 0:00.
static Date cutDate(Date date)
          sets time of day to 0:00.
static long cutDate(long date)
          sets time of day to 0:00.
static Date fillDate(Date date)
           
static long fillDate(long date)
          sets time of day to 0:00 and increases day.
static int getHourOfDay(long date)
           
static int getMinuteOfHour(long date)
           
static TimeZone getTimeZone()
          same as TimeZone.getTimeZone("GMT").
static boolean isMidnight(Date date)
           
static boolean isMidnight(long date)
           
static boolean isSameDay(Calendar calendar, Date d1, Date d2)
          uses the calendar-object for date comparison.
static boolean isSameDay(long d1, long d2)
          returns if the two dates are one the same date.
static Date subDay(Date date)
           
static Date subDays(Date date, int days)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DAYS_PER_WEEK

public static final int DAYS_PER_WEEK
See Also:
Constant Field Values

MILLISECONDS_PER_MINUTE

public static final long MILLISECONDS_PER_MINUTE
See Also:
Constant Field Values

MILLISECONDS_PER_HOUR

public static final long MILLISECONDS_PER_HOUR
See Also:
Constant Field Values

MILLISECONDS_PER_DAY

public static final long MILLISECONDS_PER_DAY
See Also:
Constant Field Values

MILLISECONDS_PER_WEEK

public static final long MILLISECONDS_PER_WEEK
See Also:
Constant Field Values

GMT

public static TimeZone GMT
Constructor Detail

DateTools

public DateTools()
Method Detail

getHourOfDay

public static int getHourOfDay(long date)

getMinuteOfHour

public static int getMinuteOfHour(long date)

cutDate

public static long cutDate(long date)
sets time of day to 0:00.

See Also:
cutDate(Date)

isMidnight

public static boolean isMidnight(long date)

isMidnight

public static boolean isMidnight(Date date)

cutDate

public static void cutDate(Calendar calendar)
sets time of day to 0:00.

See Also:
cutDate(Date)

cutDate

public static Date cutDate(Date date)
sets time of day to 0:00.


getTimeZone

public static TimeZone getTimeZone()
same as TimeZone.getTimeZone("GMT").


fillDate

public static long fillDate(long date)
sets time of day to 0:00 and increases day.

See Also:
fillDate(Date)

fillDate

public static Date fillDate(Date date)

addDay

public static Date addDay(Date date)
Monday 24:00 = tuesday 0:00. But the first means end of monday and the second start of tuesday. The default DateFormat always displays tuesday. If you want to edit the first interpretation in calendar components. call addDay() to add 1 day to the given date before displaying and subDay() for mapping a day back after editing.

See Also:
subDay(java.util.Date), addDays(java.util.Date, int)

addDays

public static Date addDays(Date date,
                           int days)
see #addDay


subDay

public static Date subDay(Date date)
See Also:
addDay(java.util.Date), subDays(java.util.Date, int)

subDays

public static Date subDays(Date date,
                           int days)
See Also:
addDay(java.util.Date)

isSameDay

public static boolean isSameDay(long d1,
                                long d2)
returns if the two dates are one the same date. Dates must be in GMT


isSameDay

public static boolean isSameDay(Calendar calendar,
                                Date d1,
                                Date d2)
uses the calendar-object for date comparison. Use this for non GMT Dates


countDays

public static long countDays(Date start,
                             Date end)

createGMTCalendar

public static Calendar createGMTCalendar()


Copyright © 2000-2006 Rapla Team. All Rights Reseserved.