com.espertech.esper.epl.datetime.calop
Class ApacheCommonsDateUtils

java.lang.Object
  extended by com.espertech.esper.epl.datetime.calop.ApacheCommonsDateUtils

public class ApacheCommonsDateUtils
extends java.lang.Object

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
static long MILLIS_PER_DAY
          Number of milliseconds in a standard day.
static long MILLIS_PER_HOUR
          Number of milliseconds in a standard hour.
static long MILLIS_PER_MINUTE
          Number of milliseconds in a standard minute.
static long MILLIS_PER_SECOND
          Number of milliseconds in a standard second.
static int MODIFY_CEILING
          Constant marker for ceiling
static int MODIFY_ROUND
          Constant marker for rounding
static int MODIFY_TRUNCATE
          Constant marker for truncating
static int SEMI_MONTH
          This is half a month, so this represents whether a date is in the top or bottom half of the month.
static java.util.TimeZone UTC_TIME_ZONE
          The UTC time zone (often referred to as GMT).
 
Constructor Summary
ApacheCommonsDateUtils()
           
 
Method Summary
static void modify(java.util.Calendar val, int field, int modType)
          Internal calculation method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTC_TIME_ZONE

public static final java.util.TimeZone UTC_TIME_ZONE
The UTC time zone (often referred to as GMT).


MILLIS_PER_SECOND

public static final long MILLIS_PER_SECOND
Number of milliseconds in a standard second.

Since:
2.1
See Also:
Constant Field Values

MILLIS_PER_MINUTE

public static final long MILLIS_PER_MINUTE
Number of milliseconds in a standard minute.

Since:
2.1
See Also:
Constant Field Values

MILLIS_PER_HOUR

public static final long MILLIS_PER_HOUR
Number of milliseconds in a standard hour.

Since:
2.1
See Also:
Constant Field Values

MILLIS_PER_DAY

public static final long MILLIS_PER_DAY
Number of milliseconds in a standard day.

Since:
2.1
See Also:
Constant Field Values

SEMI_MONTH

public static final int SEMI_MONTH
This is half a month, so this represents whether a date is in the top or bottom half of the month.

See Also:
Constant Field Values

MODIFY_TRUNCATE

public static final int MODIFY_TRUNCATE
Constant marker for truncating

See Also:
Constant Field Values

MODIFY_ROUND

public static final int MODIFY_ROUND
Constant marker for rounding

See Also:
Constant Field Values

MODIFY_CEILING

public static final int MODIFY_CEILING
Constant marker for ceiling

See Also:
Constant Field Values
Constructor Detail

ApacheCommonsDateUtils

public ApacheCommonsDateUtils()
Method Detail

modify

public static void modify(java.util.Calendar val,
                          int field,
                          int modType)

Internal calculation method.

Parameters:
val - the calendar
field - the field constant
modType - type to truncate, round or ceiling
Throws:
java.lang.ArithmeticException - if the year is over 280 million

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com