com.mapinfo.midev.type

## Class MIDate

- java.lang.Object
- - com.mapinfo.midev.type.MIDate

All Implemented Interfaces:
  Serializable, Comparable

    public final class MIDate
    extends Object
    implements Comparable, Serializable

Represents a date in the Gregorian calendar. Years, months, and days are specified in the same way they would be specified in the GregorianCalendar except for the month which is 1-based. For example, January is month 1, etc. Use the `Month` constants for month names to avoid confusion and increase readability.

See Also:
  `Month`, `GregorianCalendar`, Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`MIDate(Date date)` Constructs a new instance using from `java.util.date` using joda api.
`MIDate(int year, int month, int day)` Constructs a new instance for the specified year, month, and day.
`MIDate(long milliSeconds)` Constructs a new instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compareTo(MIDate date)`
`boolean` `equals(Object o)` Indicates whether some other object is "equal to" this one.
`int` `getDay()` Returns the day of the month.
`int` `getMonth()` Returns the month.
`long` `getTimeInMilliSeconds()` Returns the date as the number of milliseconds since the Epoch.
`int` `getYear()` Returns the year.
`int` `hashCode()` Returns a hash code value for the object.
`MIDate` `minus(MITimespan timespan)` Returns an MIDate that is the result of subtracting the specified MITimespan from this MIDate.
`MIDate` `plus(MITimespan timespan)` Returns an MIDate that is the result of adding the specified MITimespan to this MIDate.
`String` `toString()` Returns the date in MM/DD/YY format.

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### MIDate

    public MIDate(int year,
                  int month,
                  int day)

Constructs a new instance for the specified year, month, and day.

Parameters:
  `year` - the year (e.g. 1995)
  `month` - the month. Use the `Month` constants such as Month.FEBRUARY.
  `day` - the day of the month.

#### MIDate

    public MIDate(long milliSeconds)

Constructs a new instance. The date fields are initialized from the appropriate values in the supplied time in milliseconds. This time is consistent with values obtained from `Calendar.getTimeInMillis()` or `System.currentTimeMillis()`.

Parameters:
  `milliSeconds` - time in milliseconds to use to initialize this instance.

#### MIDate

    public MIDate(Date date)

Constructs a new instance using from `java.util.date` using joda api.

Parameters:
  `date` -

### Method Detail

#### getTimeInMilliSeconds

    public long getTimeInMilliSeconds()

Returns the date as the number of milliseconds since the Epoch.

Returns:
  the date as the difference in milliseconds from the Epoch.
See Also:
  `Calendar`

#### getYear

    public int getYear()

Returns the year.

Returns:
  the year

#### getMonth

    public int getMonth()

Returns the month. Months are expressed in terms of the constants defined in the `Month` class (for example, `Month.JANUARY`).

Returns:
  the month

#### getDay

    public int getDay()

Returns the day of the month.

Returns:
  the day of the month.

#### equals

    public boolean equals(Object o)

Indicates whether some other object is "equal to" this one.

Overrides:
  `equals` in class `Object`
Parameters:
  `o` - the reference object with which to compare.
Returns:
  `true` if this object equals the parameter object; `false` otherwise;

#### compareTo

    public int compareTo(MIDate date)

Specified by:
  `compareTo` in interface `Comparable`

#### hashCode

    public int hashCode()

Returns a hash code value for the object.

Overrides:
  `hashCode` in class `Object`
Returns:
  a hash code value for this object.

#### plus

    public MIDate plus(MITimespan timespan)

Returns an MIDate that is the result of adding the specified MITimespan to this MIDate.

Parameters:
  `timespan` - The MITimespan to add to this MIDate.
Returns:
  an MIDate that is the result of adding the specified MITimespane to this MIDate.

#### minus

    public MIDate minus(MITimespan timespan)

Returns an MIDate that is the result of subtracting the specified MITimespan from this MIDate.

Parameters:
  `timespan` - The MITimespan to subtract from this MIDate.
Returns:
  an MIDate that is the result of subtracting the specified MITimespan from this MIDate.

#### toString

    public String toString()

Returns the date in MM/DD/YY format.

Overrides:
  `toString` in class `Object`
Returns:
  the date in MM/DD/YY format.