net.fortuna.ical4j.util
Class Dates
java.lang.Object
net.fortuna.ical4j.util.Dates
public final class Dates
extends java.lang.Object
$Id: Dates.java,v 1.9 2008/12/16 12:34:53 fortuna Exp $
Created on 26/06/2005
Implements a collection of utility methods relevant to date processing.
static int | getAbsMonthDay(java.util.Date date, int monthDay) - Returns the absolute month day for the month specified by the
supplied date.
|
static int | getAbsWeekNo(java.util.Date date, int weekNo) - Returns the absolute week number for the year specified by the
supplied date.
|
static int | getAbsYearDay(java.util.Date date, int yearDay) - Returns the absolute year day for the year specified by the
supplied date.
|
static Calendar | getCalendarInstance(Date date) - Returns an instance of
java.util.Calendar that is suitably
initialised for working with the specified date.
|
static Date | getInstance(java.util.Date date, Value type) - Returns a new date instance of the specified type.
|
static long | round(long time, int precision)
|
static long | round(long time, int precision, TimeZone tz) - Rounds a time value to remove any precision smaller than specified.
|
DAYS_PER_WEEK
public static final int DAYS_PER_WEEK
MILLIS_PER_DAY
public static final long MILLIS_PER_DAY
MILLIS_PER_HOUR
public static final long MILLIS_PER_HOUR
MILLIS_PER_MINUTE
public static final long MILLIS_PER_MINUTE
MILLIS_PER_SECOND
public static final long MILLIS_PER_SECOND
MILLIS_PER_WEEK
public static final long MILLIS_PER_WEEK
PRECISION_DAY
public static final int PRECISION_DAY
PRECISION_SECOND
public static final int PRECISION_SECOND
getAbsMonthDay
public static int getAbsMonthDay(java.util.Date date,
int monthDay)
Returns the absolute month day for the month specified by the
supplied date. Note that a value of zero (0) is invalid for the
monthDay parameter and an IllegalArgumentException
will be thrown.
getAbsWeekNo
public static int getAbsWeekNo(java.util.Date date,
int weekNo)
Returns the absolute week number for the year specified by the
supplied date. Note that a value of zero (0) is invalid for the
weekNo parameter and an IllegalArgumentException
will be thrown.
getAbsYearDay
public static int getAbsYearDay(java.util.Date date,
int yearDay)
Returns the absolute year day for the year specified by the
supplied date. Note that a value of zero (0) is invalid for the
yearDay parameter and an IllegalArgumentException
will be thrown.
getCalendarInstance
public static Calendar getCalendarInstance(Date date)
Returns an instance of java.util.Calendar
that is suitably
initialised for working with the specified date.
getInstance
public static Date getInstance(java.util.Date date,
Value type)
Returns a new date instance of the specified type. If no type is
specified a DateTime instance is returned.
date
- a seed Java date instancetype
- the type of date instance
- an instance of
net.fortuna.ical4j.model.Date
round
public static long round(long time,
int precision)
round
public static long round(long time,
int precision,
TimeZone tz)
Rounds a time value to remove any precision smaller than specified.
time
- the time value to round