org.calendartag.util
Class CalendarTagUtil

java.lang.Object
  extended byorg.calendartag.util.CalendarTagUtil

public class CalendarTagUtil
extends java.lang.Object

Since:
Oct 3, 2004
Author:
James Smith

Constructor Summary
CalendarTagUtil()
           
 
Method Summary
static int dayCompare(java.util.Calendar leftCalendar, java.util.Calendar rightCalendar)
          Determines if the leftCalendar is before, during or after the rightCalendar based on the year, month, and day of the date only.
static int differenceInDays(java.util.Calendar a, java.util.Calendar b)
          Accurately calculates the difference between two calendars in days.
static boolean isSameDay(java.util.Calendar a, java.util.Calendar b)
          Determines if two Calendar objects are the same day, month and year.
static void trimCalendar(java.util.Calendar calendar)
          Removes the milliseconds, minutes, seconds, and hours from a Calendar object
static void trimDate(java.util.Date date)
          Uses trimCalendar to remove milliseconds, minutes, seconds, and hours from a Date object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarTagUtil

public CalendarTagUtil()
Method Detail

trimCalendar

public static void trimCalendar(java.util.Calendar calendar)
Removes the milliseconds, minutes, seconds, and hours from a Calendar object

Parameters:
calendar - the Calendar object

trimDate

public static void trimDate(java.util.Date date)
Uses trimCalendar to remove milliseconds, minutes, seconds, and hours from a Date object

Parameters:
date - The Date object

isSameDay

public static boolean isSameDay(java.util.Calendar a,
                                java.util.Calendar b)
Determines if two Calendar objects are the same day, month and year.

Parameters:
a - the first Calendar object
b - the second Calendar object
Returns:
true if they are the same day, month and year. otherwise false

dayCompare

public static int dayCompare(java.util.Calendar leftCalendar,
                             java.util.Calendar rightCalendar)
Determines if the leftCalendar is before, during or after the rightCalendar based on the year, month, and day of the date only. This is less specific than Date.before(Date) since it only compares based on the day and is capable of returning 0 when the day is the same

Parameters:
leftCalendar - the left calendar
rightCalendar - the right calendar
Returns:
-1 if the left calendar is before the right calendar, 0 if they are on the same day, +1 if the left calendar is after the right calendar

differenceInDays

public static int differenceInDays(java.util.Calendar a,
                                   java.util.Calendar b)
Accurately calculates the difference between two calendars in days.

Parameters:
a - the first calendar
b - the second calendar
Returns:
the number of days difference, 0 if they are the same,


Copyright © 2004-2005 Sourceforge. All Rights Reserved.