Holger's Java API

## com.antelmann.calendar
Class TimeInDay

    java.lang.Object
      com.antelmann.calendar.TimeInDay

All Implemented Interfaces:
  Timed, Serializable, Comparable<TimeInDay>

    public class TimeInDay

extends Object
implements Serializable, Comparable<TimeInDay>, Timed

represents the time of the day of any given date. For String representation, it uses the format `H:mm`.

Since:
  Feb 2006
Author:
  Holger Antelmann
See Also:
  `SimpleDateFormat`, Serialized Form

Field Summary
`static SimpleDateFormat` `FOMRAT` the format used to convert between TimeInDay and String using 'H:mm'

Fields inherited from interface com.antelmann.calendar.Timed
`COMPARATOR, DATE_EXTRACTOR`

Constructor Summary
`TimeInDay()` uses the current time
`TimeInDay(Date time)` takes the time of the day from the given time
`TimeInDay(long timeInDay)` time in milliseconds from 12:00 am (must be less than 24h)
`TimeInDay(String hourString)` uses the format 'H:mm'
`TimeInDay(TimeInDay tid)`

Method Summary
`boolean` `after(Date time)`
`boolean` `after(TimeInDay time)`
`boolean` `before(Date time)`
`boolean` `before(TimeInDay time)`
`int` `compareTo(TimeInDay time)`
`boolean` `equals(Object obj)`
`Date` `getDate(Date inDay)` returns the date that is calculated by taking the beginning of the given day and adds this TimeInDay's value.
`int` `getMillis()`
`long` `getTime()` returns the millseconds after midnight (always save to cast the return value to int)
`int` `hashCode()`
`static int` `parse(String s)` returns the milliseconds after midnight represented by the given String in hour format
`void` `setTime(Date time)`
`void` `setTime(long timeInDay)` takes time in milliseconds from 12:00 am (must be less than 24h)
`String` `toString()`

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

Field Detail

### FOMRAT

    public static final SimpleDateFormat FOMRAT

  the format used to convert between TimeInDay and String using 'H:mm'

Constructor Detail

### TimeInDay

    public TimeInDay()

  uses the current time

### TimeInDay

    public TimeInDay(Date time)

  takes the time of the day from the given time

### TimeInDay

    public TimeInDay(long timeInDay)

  time in milliseconds from 12:00 am (must be less than 24h)

### TimeInDay

    public TimeInDay(TimeInDay tid)

### TimeInDay

    public TimeInDay(String hourString)
              throws ParseException

  uses the format 'H:mm'

  Throws:
    `ParseException`

Method Detail

### setTime

    public void setTime(Date time)

### setTime

    public void setTime(long timeInDay)

  takes time in milliseconds from 12:00 am (must be less than 24h)

### getDate

    public Date getDate(Date inDay)

  returns the date that is calculated by taking the beginning of the given day and adds this TimeInDay's value.

### before

    public boolean before(TimeInDay time)

### after

    public boolean after(TimeInDay time)

### before

    public boolean before(Date time)

### after

    public boolean after(Date time)

### getMillis

    public int getMillis()

### getTime

    public long getTime()

  returns the millseconds after midnight (always save to cast the return value to int)

  Specified by:
    `getTime` in interface `Timed`

### compareTo

    public int compareTo(TimeInDay time)

  Specified by:
    `compareTo` in interface `Comparable<TimeInDay>`

### parse

    public static int parse(String s)
                     throws ParseException

  returns the milliseconds after midnight represented by the given String in hour format

  Throws:
    `ParseException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads