## 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, ValueRepresentation

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, XPathContext context)` Determine the difference between two points in time, as a duration

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

Methods inherited from class net.sf.saxon.value.Value
`analyze, asItem, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, convertToJava, equals, getDependencies, getItemType, getIterator, getParentExpression, getSpecialProperties, hashCode, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, promote, simplify, stringToNumber, trimWhitespace`

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

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

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

  Throws:
    `XPathException`

### subtract

    public SecondsDurationValue subtract(CalendarValue other,
                                         XPathContext context)
                                  throws XPathException

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

  Parameters:
    `other` - the other point in time
    `context` - the dynamic context, used to obtain timezone information. May be set to null only if both values contain an explicit timezone.
  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`