Interface DateTime

All Superinterfaces:
Comparable<DateTime>, DateTime, OsidPrimitive, OsidPrimitive, Serializable

public interface DateTime extends OsidPrimitive, DateTime

The DateTime interface defines a date and/or time. This interface provides a very broad range of dates, describes more or less precision, and/or conveys an uncertainty. A number of convenience methods for retrieving time elements are available but only those methods covered by the specified granularity are valid.

A typical example is describing a day where the time isn't known, and the event did not occur at midnight.

getMillennium() == 2
getCentury() == 18
getYear() == 1776
getMonth() == 7
getDay() == 4
getHour() == 0
getGranularity() == DateTimeResolution.DAY
definesUncertainty() == false            
  

Another example showing that the time is probably 1pm but could have been as late as 3pm or early as noon.

getMillennium() == 3
getCentury() == 21
getYear() == 2008
getMonth() == 3
getDay() == 17
getHour() == 13
getMinute() == 0
getGranularity() == TimeResolution.MINUTE
definesUncertainty() == true
getUncertaintyGranularity() == DateTimeResolution.HOUR
getUncertaintyMinus() == 1
getUncertaintyPlus == 2            
  

An example marking the birth of the universe. 13.73 billion years +/- 120 million years. The granularity suggests that no more resolution than one million years can be inferred from the "clock", making errors in the exact number of millennia insignificant.

getEpoch() == -13,730
getMillennium() == 0
getCentury() == 0
getYear() == 0
getGranularity() == TimeResolution.EPOCH
definesUncertainty() == true
getUncertaintyGranularity() == DateTimeResolution.EPOCH
getUncertaintyMinus() == 120
getUncertaintyPlus == 120            
  
  • Method Details

    • getCalendarType

      Type getCalendarType()
      Gets the calendar type.
      Returns:
      the calendar type
      Compliance:
      mandatory - This method must be implemented.
    • getAeon

      long getAeon()
      Gets the aeon starting from 1. An aeon is 1B years.
      Returns:
      the aeon
      Compliance:
      mandatory - This method must be implemented.
    • getEpoch

      long getEpoch()
      Gets the epoch starting from 1. An epoch is 1M years.
      Returns:
      the eposh
      Compliance:
      mandatory - This method must be implemented.
    • getMillennium

      long getMillennium()
      Gets the millennium starting from 1. A millenium is 1,000 years.
      Returns:
      the millennium
      Compliance:
      mandatory - This method must be implemented.
    • getCentury

      long getCentury()
      Gets the century starting from 1.
      Returns:
      the century
      Compliance:
      mandatory - This method must be implemented.
    • getYear

      long getYear()
      Gets the year starting from 1.
      Returns:
      the year
      Compliance:
      mandatory - This method must be implemented.
    • getMonth

      long getMonth()
      Gets the month number starting from 1.
      Returns:
      the month
      Compliance:
      mandatory - This method must be implemented.
    • getDay

      long getDay()
      Gets the day of the month starting from 1.
      Returns:
      the day of the month
      Compliance:
      mandatory - This method must be implemented.
    • getTimeType

      Type getTimeType()
      Gets the time type.
      Returns:
      the time type
      Compliance:
      mandatory - This method must be implemented.
    • getHour

      long getHour()
      Gets the hour of the day 0-23.
      Returns:
      the hour of the day
      Compliance:
      mandatory - This method must be implemented.
    • getMinute

      long getMinute()
      Gets the minute of the hour 0-59.
      Returns:
      the minute of the hour
      Compliance:
      mandatory - This method must be implemented.
    • getSecond

      long getSecond()
      Gets the second of the minute 0-59.
      Returns:
      the second of the minute
      Compliance:
      mandatory - This method must be implemented.
    • getMilliseconds

      long getMilliseconds()
      Gets the number of milliseconds in this second 0-999. A millisecond is one thousandth of a second.
      Returns:
      the milliseconds of the second
      Compliance:
      mandatory - This method must be implemented.
    • getMicroseconds

      long getMicroseconds()
      Gets the number of microseconds of the second 0-999. A microsecond is one millionth of a second.
      Returns:
      the micrseconds of the millisecond
      Compliance:
      mandatory - This method must be implemented.
    • getNanoseconds

      long getNanoseconds()
      Gets the number of nanoseconds of the microsecond 0-999. A nanosecond is one billionth of a second.
      Returns:
      the nanoseconds of the microsecond
      Compliance:
      mandatory - This method must be implemented.
    • getPicoseconds

      long getPicoseconds()
      Gets the number of picoseconds of the nanosecond 0-999. A picosecond is one trillionth of a second.
      Returns:
      the picoseconds of the nanosecond
      Compliance:
      mandatory - This method must be implemented.
    • getFemtoseconds

      long getFemtoseconds()
      Gets the number of femtoseconds of the picosecond 0-999. A femtosecond is one quadrillionth of a second.
      Returns:
      the femtoseconds of the picosecond
      Compliance:
      mandatory - This method must be implemented.
    • getAttoseconds

      long getAttoseconds()
      Gets the number of attoseconds of the femtoseconds 0-999. An attosecond is one quintillionth of a second.
      Returns:
      the attoseconds of the femtosecond
      Compliance:
      mandatory - This method must be implemented.
    • getZeptoseconds

      long getZeptoseconds()
      Gets the number of zeptoseconds of the attosecond 0-999. A zeptosecond is one sextillionth of a second.
      Returns:
      the zeptoseconds of the attosecond
      Compliance:
      mandatory - This method must be implemented.
    • getYoctoseconds

      long getYoctoseconds()
      Gets the number of yoctoseconds of the picosecond 0-999. A yoctosecond is one septillionth of a second. This is getting quite small.
      Returns:
      the yoctoseconds of the picosecond
      Compliance:
      mandatory - This method must be implemented.
    • getXoxxoseconds

      long getXoxxoseconds()
      Gets the number of xoxxoseconds of the yoctosecond 0-999. A xoxxosecond is one octillionth of a second. We're going with Rudy Rucker here.
      Returns:
      the xoxxoseconds of the yoctosecond
      Compliance:
      mandatory - This method must be implemented.
    • getWeebleseconds

      long getWeebleseconds()
      Gets the number of weebleseconds of the xoxxosecond 0-999. A weeblesecond is one nonillionth of a second.
      Returns:
      the weebleseconds of the xoxxoseconds
      Compliance:
      mandatory - This method must be implemented.
    • getVatoseconds

      long getVatoseconds()
      Gets the number of vatoseconds of the xoxxosecond 0-999. A vatosecond is one decillionth of a second.
      Returns:
      the vatoseconds of the weeblesecond
      Compliance:
      mandatory - This method must be implemented.
    • getUndaseconds

      long getUndaseconds()
      Gets the number of undaseconds of the vatosecond 0-999. An undasecond is one unadecillionth of a second.
      Returns:
      the undaseconds of the vatosecond
      Compliance:
      mandatory - This method must be implemented.
    • getPlanckSeconds

      long getPlanckSeconds()
      Gets the number of Plancks of the vatoseconds. A Planck is 10 quattuordecillionths of a second.
      Returns:
      the plancks of the undasecond
      Compliance:
      mandatory - This method must be implemented.
    • getGranularity

      DateTimeResolution getGranularity()
      Gets the granularity of this time. The granularity indicates the resolution of the clock. More precision than what is specified in this method cannot be inferred from the available data.
      Returns:
      granularity
      Compliance:
      mandatory - This method must be implemented.
    • getGranularityMultiplier

      long getGranularityMultiplier()
      If the granularity of the time equals getGranularity() , then the multiplier is 1. This method may return a different number when the granularity differs from one of the defined resolutions.
      Returns:
      granularity multiplier
      Compliance:
      mandatory - This method must be implemented.
    • definesUncertainty

      boolean definesUncertainty()
      Tests if uncertainty is defined for this time.
      Returns:
      true if uncertainty is defined, false otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getUncertaintyUnits

      DateTimeResolution getUncertaintyUnits()
      Gets the units of the uncertainty.
      Returns:
      units of the uncertainty
      Throws:
      IllegalStateException - definesUncertainty() is false
      Compliance:
      mandatory - This method must be implemented.
    • getUncertaintyMinus

      long getUncertaintyMinus()
      Gets the uncertainty of this time in the negative direction.
      Returns:
      the uncertainty under this value
      Throws:
      IllegalStateException - definesUncertainty() is false
      Compliance:
      mandatory - This method must be implemented.
    • getUncertaintyPlus

      long getUncertaintyPlus()
      Gets the uncertainty of this time in the positive direction.
      Returns:
      the uncertainty over this value
      Throws:
      IllegalStateException - definesUncertainty() is false
      Compliance:
      mandatory - This method must be implemented.
    • isUncertaintyDateInclusive

      boolean isUncertaintyDateInclusive()
      Tests if the uncertainty is inclusive of all dates. An inclusive uncertainty includes the entire range specified by the uncertainty units e.g. +/- 1 year includes all of the months and days within that interval. A non-inclusive uncertainty would mean the year is uncertain but the month and day is certain.
      Returns:
      true if the uncertainty includes all dates, false otherwise
      Throws:
      IllegalStateException - definesUncertainty() is false
      Compliance:
      mandatory - This method must be implemented.
    • isUncertaintyTimeInclusive

      boolean isUncertaintyTimeInclusive()
      Tests if the uncertainty is time inclusive. An inclusive uncertainty includes the entire range specified by the uncertainty units e.g. +/- 1 year includes all of the seconds within that interval. A non-inclusive uncertainty would mean the year is uncertain but the time is certain.
      Returns:
      true if the uncertainty includes all times, false otherwise
      Throws:
      IllegalStateException - definesUncertainty() is false
      Compliance:
      mandatory - This method must be implemented.