|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.fortuna.ical4j.util.Dates
public final class Dates
$Id$ Created on 26/06/2005 Implements a collection of utility methods relevant to date processing.
Field Summary | |
---|---|
static int |
DAYS_PER_WEEK
Number of days in one week. |
static int |
MAX_DAYS_PER_MONTH
Maximum number of days per month. |
static int |
MAX_DAYS_PER_YEAR
Maximum number of days per year. |
static int |
MAX_WEEKS_PER_YEAR
Maximum number of weeks per year. |
static long |
MILLIS_PER_DAY
Number of milliseconds in one day. |
static long |
MILLIS_PER_HOUR
Number of milliseconds in one hour. |
static long |
MILLIS_PER_MINUTE
Number of milliseconds in one minute. |
static long |
MILLIS_PER_SECOND
Number of milliseconds in one second. |
static long |
MILLIS_PER_WEEK
Number of milliseconds in one week. |
static int |
PRECISION_DAY
Constant indicating precision to the day. |
static int |
PRECISION_SECOND
Constant indicating precision to the second. |
Method Summary | |
---|---|
static int |
getAbsMonthDay(Date date,
int monthDay)
Returns the absolute month day for the month specified by the supplied date. |
static int |
getAbsWeekNo(Date date,
int weekNo)
Returns the absolute week number for the year specified by the supplied date. |
static int |
getAbsYearDay(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 long |
getCurrentTimeRounded()
Returns the System.currentTimeMillis() , rounded to the second. |
static Date |
getInstance(Date date,
Value type)
Returns a new date instance of the specified type. |
static long |
round(long time,
int precision)
Deprecated. It is not all that useful to perform rounding without specifying an explicit timezone. |
static long |
round(long time,
int precision,
TimeZone tz)
Rounds a time value to remove any precision smaller than specified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long MILLIS_PER_SECOND
public static final long MILLIS_PER_MINUTE
public static final long MILLIS_PER_HOUR
public static final long MILLIS_PER_DAY
public static final long MILLIS_PER_WEEK
public static final int DAYS_PER_WEEK
public static final int PRECISION_SECOND
public static final int PRECISION_DAY
public static final int MAX_WEEKS_PER_YEAR
public static final int MAX_DAYS_PER_YEAR
public static final int MAX_DAYS_PER_MONTH
Method Detail |
---|
public static int getAbsWeekNo(Date date, int weekNo)
IllegalArgumentException
will be thrown.
date
- a date instance representing a week of the yearweekNo
- a week number offset
public static int getAbsYearDay(Date date, int yearDay)
IllegalArgumentException
will be thrown.
date
- a date instance representing a day of the yearyearDay
- a day of year offset
public static int getAbsMonthDay(Date date, int monthDay)
IllegalArgumentException
will be thrown.
date
- a date instance representing a day of the monthmonthDay
- a day of month offset
public static Date getInstance(Date date, Value type)
date
- a seed Java date instancetype
- the type of date instance
net.fortuna.ical4j.model.Date
public static Calendar getCalendarInstance(Date date)
java.util.Calendar
that is suitably
initialised for working with the specified date.
date
- a date instance
java.util.Calendar
public static long round(long time, int precision)
time
- the time value to roundprecision
- the rounding precision
public static long round(long time, int precision, TimeZone tz)
time
- the time value to roundprecision
- the rounding precisiontz
- the timezone of the rounded value
public static long getCurrentTimeRounded()
System.currentTimeMillis()
, rounded to the second.
By doing a rough rounding here, we avoid an expensive java.util.Calendar based rounding later on.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |