com.compoze.collab.util
Class CalendarUtility

java.lang.Object
  extended by com.compoze.collab.util.CalendarUtility

public class CalendarUtility
extends Object

This class contains utility methods for manipulating calendars and related items.


Constructor Summary
CalendarUtility()
           
 
Method Summary
static void main(String[] args)
          Exerciser.
static Date roundDate(Date date)
          Rounds a date to the nearest midnight.
static Date truncateDate(Date date, int iField)
          Truncates a date to the resolution of the given calendar field.
static Date truncateDate(Date date, int iField, Calendar cal)
          Truncates a date to the resolution of the given calendar field.
static Date truncateDate(Date date, int iField, Locale locale)
          Truncates a date to the resolution of the given calendar field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalendarUtility

public CalendarUtility()
Method Detail

truncateDate

public static Date truncateDate(Date date,
                                int iField)
Truncates a date to the resolution of the given calendar field. The remaining less significant fields will be set to their minimum value.

Parameters
date - date to round
iField - the calendar field (valid fields are YEAR, MONTH, DATE, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND)- fields less significant than this will be set to their minimum value
Returns
the rounded date
See Also
Calendar

truncateDate

public static Date truncateDate(Date date,
                                int iField,
                                Locale locale)
Truncates a date to the resolution of the given calendar field. The remaining less significant fields will be set to their minimum value.

Parameters
date - date to round
iField - the calendar field (valid fields are YEAR, MONTH, DATE, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND)- fields less significant than this will be set to their minimum value
locale - the locale to use
Returns
the rounded date
See Also
Calendar

truncateDate

public static Date truncateDate(Date date,
                                int iField,
                                Calendar cal)
Truncates a date to the resolution of the given calendar field. The remaining less significant fields will be set to their minimum value.

Parameters
date - date to trucate (null to not set the calendar time)
iField - the calendar field (valid fields are YEAR, MONTH, DATE, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND)- fields less significant than this will be set to their minimum value
cal - the calendar to use
Returns
the date
See Also
Calendar

roundDate

public static Date roundDate(Date date)
Rounds a date to the nearest midnight.

Parameters
date - date to round
Returns
the rounded date
See Also
Calendar

main

public static void main(String[] args)
Exerciser.

Parameters
args - arguments (none taken)


Copyright © 2006 BEA Systems, Inc. All Rights Reserved