com.mapinfo.midev.type

## Class MIDateTime

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

All Implemented Interfaces:
  Serializable, Comparable

    public final class MIDateTime
    extends Object
    implements Comparable, Serializable

Represents a date and time in the Gregorian calendar. Years, months, days, hours, and minutes are specified in the same way they would be specified in the `GregorianCalendar` except for the month which is expressed as a 1-based integer. For example, January is month 1, etc. Use the `Month` constants for month names to avoid confusion and increase readability. Seconds are specified as a double, however, the value is only significant to three decimal places (milliseconds).

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

### Constructor Summary

Constructors
Constructor and Description
`MIDateTime(int year, int month, int day, int hour, int minute, double seconds)` Constructs a new instance.
`MIDateTime(long milliSeconds)` Constructs a new instance.
`MIDateTime(MIDate date, MITime time)` Constructs a new instance as the concatenation of a date and a time.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compareTo(MIDateTime dateTime)`
`boolean` `equals(Object o)` Indicates whether some other object is "equal to" this one.
`int` `getDay()` Returns the day of the month.
`int` `getHour()` Returns the hour
`int` `getMinute()` Returns the minute of the hour.
`int` `getMonth()` Returns the month.
`double` `getSeconds()` Returns the seconds.
`long` `getTimeInMilliSeconds()` Returns the date and time as the number of milliseconds since the Epoch.
`int` `getYear()` Returns the year.
`int` `hashCode()` Returns a hash code value for the object.
`String` `toString()` Returns the date and time in MM/DD/YY hh:mm:ss format.

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

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

### Constructor Detail

#### MIDateTime

    public MIDateTime(int year,
                      int month,
                      int day,
                      int hour,
                      int minute,
                      double seconds)

Constructs a new instance.

Parameters:
  `year` - the year in the Gregorian calendar
  `month` - the month. Use the `Month` constants such as Month.FEBRUARY.
  `day` - the day of the month.
  `hour` - the hour
  `minute` - the minutes of the hour
  `seconds` - the seconds.

#### MIDateTime

    public MIDateTime(MIDate date,
                      MITime time)

Constructs a new instance as the concatenation of a date and a time.

Parameters:
  `date` - the date
  `time` - the time

#### MIDateTime

    public MIDateTime(long milliSeconds)

Constructs a new instance. The date and time 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.

### Method Detail

#### getTimeInMilliSeconds

    public long getTimeInMilliSeconds()

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

Returns:
  the date and time 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.

#### getHour

    public int getHour()

Returns the hour

Returns:
  the hour.

#### getMinute

    public int getMinute()

Returns the minute of the hour.

Returns:
  the minute of the hour.

#### getSeconds

    public double getSeconds()

Returns the seconds. The seconds supplied are retained and returned by this method. However, equality are comparisons are sensitive to milliseconds only.

Returns:
  the seconds.

#### compareTo

    public int compareTo(MIDateTime dateTime)

Specified by:
  `compareTo` in interface `Comparable`

#### 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;

#### 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.

#### toString

    public String toString()

Returns the date and time in MM/DD/YY hh:mm:ss format.

Overrides:
  `toString` in class `Object`
Returns:
  the date and time in MM/DD/YY hh:mm:ss format.