# com.bea.p13n.xml.schema
Month Class

public class Month
extends `Year`
implements `Cloneable`, `Comparable`, `Serializable`

This class provides the Java biding for the XML schema type month as specified in Section 3.3.28 of XML Schema Part 2: Datatypes.

month represents a specific period of time that starts on the first day of the month and lasts until the midnight that ends the last day of the month.

The value space of month is the set of Gregorian calendar months specified as CCYY-MM. It is a set of one-month long, non-period instances independent of how many days this month has.

Example: `2001-01`.

Hierarchy
  `Object`
  `Century`
  `Year`
  `Month`

All Implemented Interfaces
  `Cloneable`, `Comparable`, `Serializable`

Direct Known Subclasses
  `Date`

## Field Summary

Fields from com.bea.p13n.xml.schema`.`Century``
``_internal``

## Constructor Summary

Month() Constructs a new Month instance.
Month(long year, int month, `TimeZone` timeZone) Constructs a new Month for the given year, month and timezone.

## Method Summary

`public `Object`` | `clone`() Returns a copy of this Month.
`public int` | `compareTo`(`Month` anotherMonth) Compares this Month to another Month object (represented in the same time zone) in their canonical representation.
`public int` | `compareTo`(`Object` anotherObject) Compares this TimePeriod with another object.
`public static `Month`` | `createMonth`() Returns a Month instance for the current month.
`public static `Month`` | `createMonth`(`String` month) Given a string of the form CCYY-MM, returns a Month instance.
`public int` | `getMonth`() Returns the month (MM) field
`public void` | `setMonth`(int month) Sets the month (MM) field
`public `String`` | `toString`() Returns a XML schema compliant date string.
`public `Object`` | `toUTC`() Offsets the current month instant to UTC.

Methods from `com.bea.p13n.xml.schema.`Year``
``compareTo`, `createYear`, `createYear`, `getYear`, `setYear`, `setYear`,`

Methods from `com.bea.p13n.xml.schema.`Century``
``clone`, `compareTo`, `compareTo`, `createCentury`, `createCentury`, `getCentury`, `getEra`, `getTimeZone`, `setCentury`, `setEra`, `setTimeZone`, `setTimeZone`, `toString`, `toUTC``

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

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

## Constructor Detail

### Month

    protected Month()

  Constructs a new Month instance.

### Month

    protected Month(long year,
                    int month,
                    TimeZone timeZone)

  Constructs a new Month for the given year, month and timezone.

## Method Detail

### clone() Method

    public Object clone()

Returns a copy of this Month.

Overrides
  `Year.clone()`

#### Returns

copy

### compareTo(Month) Method

    public int compareTo(Month anotherMonth)

Compares this Month to another Month object (represented in the same time zone) in their canonical representation.

#### Parameters

anotherMonth
  another Month object to be compared.

#### Returns

the value 0 if the argument Month is equal to this Month; a value less than 0 if this Month is before the Month argument; and a value greater than 0 if this Month is after the Month argument.

### compareTo(Object) Method

    public int compareTo(Object anotherObject)

Compares this TimePeriod with another object. If the other object is a Month, this method behaves like compareTo(Month). Otherwise, it throws a ClassCastException.

Overrides
  `Year.compareTo(Object)`

#### Parameters

anotherObject
  the object to be compared

#### Returns

the value 0 if the argument Month is equal to this Month; a value less than 0 if this Month is before the Month argument; and a value greater than 0 if this Month is after the Month argument.

### createMonth() Method

    public static Month createMonth()

Returns a Month instance for the current month.

#### Returns

instance of Month

### createMonth(String) Method

    public static Month createMonth(String month)
         throws ParseException

Given a string of the form CCYY-MM, returns a Month instance.

The argument may optionally include a timezone.

#### Returns

instance of Month

#### Exceptions

``ParseException``

### getMonth() Method

    public int getMonth()

Returns the month (MM) field

#### Returns

the month

### setMonth(int) Method

    public void setMonth(int month)
         throws IllegalArgumentException

Sets the month (MM) field

#### Parameters

month
  the month (MM)

#### Exceptions

``IllegalArgumentException``
  thrown when the month argument is illegal

### toString() Method

    public String toString()

Returns a XML schema compliant date string.

Overrides
  `Year.toString()`

#### Returns

string value

### toUTC() Method

    public Object toUTC()

Offsets the current month instant to UTC.

Overrides
  `Year.toUTC()`

#### Returns

instance of Month offset to UTC