## net.sf.saxon.value
Class CalendarValue

    java.lang.Object
      |
      +--net.sf.saxon.value.Value
            |
            +--net.sf.saxon.value.AtomicValue
                  |
                  +--net.sf.saxon.value.CalendarValue

All Implemented Interfaces:
  java.lang.Comparable, Expression, Item, java.io.Serializable

Direct Known Subclasses:
  DateTimeValue, DateValue, TimeValue

public abstract class CalendarValue
extends AtomicValue
implements java.lang.Comparable

Abstract superclass for Date, Time, and DateTime

See Also:
  Serialized Form

Field Summary
`protected java.util.GregorianCalendar` `calendar`
`protected boolean` `zoneSpecified`

Fields inherited from interface net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Constructor Summary
`CalendarValue()`

Method Summary
`abstract CalendarValue` `add(DurationValue duration)`
`abstract CalendarValue` `removeTimezone()` Return a date, time, or dateTime with the same localized value, but without the timezone component
`abstract CalendarValue` `setTimezone(SecondsDurationValue tz)` Return a date, time, or dateTime with the same normalized value, but in a different timezone
`SecondsDurationValue` `subtract(CalendarValue other)` Determine the difference between two points in time, as a duration

Methods inherited from class net.sf.saxon.value.AtomicValue
`convert, convert, convertToJava, display, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getComponent, getImplementationMethod, getPrimitiveValue, getStringValue, getTypedValue, iterate, process, toString`

Methods inherited from class net.sf.saxon.value.Value
`analyze, asItem, asValue, collapseWhitespace, convertJavaObjectToXPath, getDependencies, getParentExpression, getSpecialProperties, inverse, iterateSubExpressions, normalizeWhitespace, promote, simplify, stringToNumber, trimWhitespace`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.lang.Comparable
`compareTo`

Methods inherited from interface net.sf.saxon.expr.Expression
`getItemType`

Field Detail

### calendar

    protected java.util.GregorianCalendar calendar

### zoneSpecified

    protected boolean zoneSpecified

Constructor Detail

### CalendarValue

    public CalendarValue()

Method Detail

### add

    public abstract CalendarValue add(DurationValue duration)
                               throws XPathException

    `XPathException`

### subtract

    public SecondsDurationValue subtract(CalendarValue other)
                                  throws XPathException

  Determine the difference between two points in time, as a duration

  Parameters:
    `other` - the other point in time
  Returns:
    the duration as an xdt:dayTimeDuration
  Throws:
    `XPathException` - for example if one value is a date and the other is a time

### removeTimezone

    public abstract CalendarValue removeTimezone()
                                          throws XPathException

  Return a date, time, or dateTime with the same localized value, but without the timezone component

  Returns:
    the result of removing the timezone
  Throws:
    `XPathException`

### setTimezone

    public abstract CalendarValue setTimezone(SecondsDurationValue tz)
                                       throws XPathException

  Return a date, time, or dateTime with the same normalized value, but in a different timezone

  Returns:
    the date/time in the new timezone
  Throws:
    `XPathException`