Class ApacheCommonsDateUtils
java.lang.Object
com.espertech.esper.common.internal.epl.datetime.calop.ApacheCommonsDateUtils
A suite of utilities surrounding the use of the
Calendar
and Date
object.
DateUtils contains a lot of common methods considering manipulations of Dates or Calendars. Some methods require some extra explanation. The truncate, ceiling and round methods could be considered the Math.floor(), Math.ceil() or Math.round versions for dates This way date-FIELDS will be ignored in bottom-up order. As a complement to these methods we've introduced some fragment-methods. With these methods the Date-FIELDS will be ignored in top-down order. Since a date without a year is not a valid date, you have to decide in what kind of date-field you want your result, for instance milliseconds or days.
- Since:
- 2.0
- Version:
- $Id: DateUtils.java 1056840 2011-01-09 00:12:23Z niallp $
- Author:
- Apache Software Foundation, Serge Knystautas, Janek Bogucki, Gary Gregory, Phil Steitz, Robert Scholte
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Number of milliseconds in a standard day.static final long
Number of milliseconds in a standard hour.static final long
Number of milliseconds in a standard minute.static final long
Number of milliseconds in a standard second.static final int
Constant marker for ceilingstatic final int
Constant marker for roundingstatic final int
Constant marker for truncatingstatic final int
This is half a month, so this represents whether a date is in the top or bottom half of the month.static final TimeZone
The UTC time zone (often referred to as GMT). -
Constructor Summary
-
Method Summary
-
Field Details
-
UTC_TIME_ZONE
The UTC time zone (often referred to as GMT). -
MILLIS_PER_SECOND
public static final long MILLIS_PER_SECONDNumber of milliseconds in a standard second.- Since:
- 2.1
- See Also:
-
MILLIS_PER_MINUTE
public static final long MILLIS_PER_MINUTENumber of milliseconds in a standard minute.- Since:
- 2.1
- See Also:
-
MILLIS_PER_HOUR
public static final long MILLIS_PER_HOURNumber of milliseconds in a standard hour.- Since:
- 2.1
- See Also:
-
MILLIS_PER_DAY
public static final long MILLIS_PER_DAYNumber of milliseconds in a standard day.- Since:
- 2.1
- See Also:
-
SEMI_MONTH
public static final int SEMI_MONTHThis is half a month, so this represents whether a date is in the top or bottom half of the month.- See Also:
-
MODIFY_TRUNCATE
public static final int MODIFY_TRUNCATEConstant marker for truncating- See Also:
-
MODIFY_ROUND
public static final int MODIFY_ROUNDConstant marker for rounding- See Also:
-
MODIFY_CEILING
public static final int MODIFY_CEILINGConstant marker for ceiling- See Also:
-
-
Constructor Details
-
ApacheCommonsDateUtils
public ApacheCommonsDateUtils()
-
-
Method Details
-
modify
Internal calculation method.
- Parameters:
val
- the calendarfield
- the field constantmodType
- type to truncate, round or ceiling- Throws:
ArithmeticException
- if the year is over 280 million
-