Class C360UTCDateTime
java.lang.Object
net.okapia.osid.primordium.calendaring.datetime.spi.AbstractDateTime
net.okapia.osid.primordium.calendaring.datetime.spi.AbstractConfigurableDateTime
net.okapia.osid.primordium.calendaring.datetime.alternate.C360UTCDateTime
- All Implemented Interfaces:
Serializable, Comparable<DateTime>, DateTime, OsidPrimitive, DateTime, OsidPrimitive
A 360-day commercial date with a UTC time of day.
The date follows the C360Calendar; twelve thirty-day months and no leap, the idealized 30/360 year. The time of day is a
UTCTime.
As with the Gregorian implementation, a granularity is valid only when
this interface has an element to convey it; the grouping resolutions
without an element of their own (DECADE, BLUEMOON,
GLACIAL, HALF_HOUR, and QUARTER_HOUR)
are rejected at construction.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe factory used to constructC360UTCDateTimes.static classThe specifier used to constructC360UTCDateTimes. -
Field Summary
FieldsFields inherited from class AbstractConfigurableDateTime
GREGORIAN_REFORM, YEARS_PER_BLUEMOONModifier and TypeFieldDescriptionprotected static final Instantthe gregorian reformstatic final BigDecimalthe years per bluemoon -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newC360UTCDateTime. -
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimedatetime(long year) Creates a DateTime at year resolution.static DateTimedatetime(long year, long month) Creates a DateTime at month resolution.static DateTimedatetime(long year, long month, long day) Creates a DateTime at day resolution.static DateTimeCreates a DateTime at a date and time.static DateTimeParses an ISO date string.static DateTimeinfinity()Gets an infinite date.static DateTimeCreates a DateTime from a strict ISO 8601 string.static DateTimeunknown()Gets an unknown date.static DateTimevalueOf(long year) Creates a DateTime at year resolution.static DateTimevalueOf(long year, long month) Creates a DateTime at month resolution.static DateTimevalueOf(long year, long month, long day) Creates a DateTime at day resolution.static DateTimeCreates a DateTime at a date and time.static DateTimeParses an ISO date string.Methods inherited from class AbstractConfigurableDateTime
compare, compareTo, denormalize, equals, formatDigits, formatNumber, formatYear, fromComponents, fromInstant, fromLocalDateTime, fromOffsetDateTime, fromZonedDateTime, getDateTimeFactory, getTime, getWeek, hashCode, isExclusive, isGreater, isInclusive, isLess, minus, minus, parse, parseISO, plus, plus, requireResolution, toLocaleDateString, toLocaleTimeString, toShortLocaleDateString, toString, toTime, toTimeStringModifier and TypeMethodDescriptionprotected static intcompare(DateTime dt1, DateTime dt2, DateTimeFactory factory) Compares two normalized finite datetimes.intCompares this DateTime with the specified DateTime for ordering.final DateTimeIntervalReturns an interval based on this DateTime derived by its granularity and uncertainty.final booleanDetermines if the givenTimeis equal to this one.protected static StringformatDigits(long num, int n) Formats a number, zero-padded to a minimum number of digits.protected static StringformatNumber(long num) Formats a number as an ordinal (1st, 2nd, 3rd, ...).protected static StringformatYear(long year) Formats a year for display, zero-padded to four digits within the common range.protected static DateTimefromComponents(DateTimeFactory factory, long year, long month, long day, Time time) Builds a DateTime from explicit calendar components.protected static DateTimefromInstant(DateTimeFactory factory, Instant instant, DateTimeResolution granularity) Converts a JavaInstantto a DateTime.protected static DateTimefromLocalDateTime(DateTimeFactory factory, LocalDateTime ldt, DateTimeResolution granularity) Converts a JavaLocalDateTimeto a DateTime, treating the value as already in UTC.protected static DateTimefromOffsetDateTime(DateTimeFactory factory, OffsetDateTime odt, DateTimeResolution granularity) Converts a JavaOffsetDateTimeto a DateTime, adjusting to UTC.protected static DateTimefromZonedDateTime(DateTimeFactory factory, ZonedDateTime zdt, DateTimeResolution granularity) Converts a JavaZonedDateTimeto a DateTime, adjusting to UTC.protected DateTimeFactoryGets the datetime factory.protected TimegetTime()Gets the time component.final longgetWeek()Gets the week of the year, counting from one.final inthashCode()Returns a hash code value for thisTimebased on the type, granularity and values.final booleanisExclusive(DateTime datetime) Tests if the range of this DateTime, as specified by its granularity and uncertainty, does not overlap with the given DateTime.booleanTests if this DateTime is greater than the given DateTime.final booleanisInclusive(DateTime datetime) Tests if the range of this DateTime, as specified by its granularity and uncertainty, includes the given DateTime ranged by its grabularity and uncertainty.final booleanTests if this DateTime is less than the given DateTime.minus(long amount, DateTimeResolution unit) Subtracts a number of a resolution's units from this datetime.Subtracts a duration from this datetime.protected static DateTimeparse(DateTimeFactory factory, String string) Parses the okapia-extended datetime form: a strict ISO datetime optionally trailed by an uncertainty (" ±n unit" / " +p -m unit", with an optional "exclusive"), or the standalone "?" (unknown) and "infinity".protected static DateTimeparseISO(DateTimeFactory factory, String iso) Parses an ISO date string.plus(long amount, DateTimeResolution unit) Adds a number of a resolution's units to this datetime, in its own calendar.Adds a duration to this datetime, applying its calendar components (years, months, weeks, days) and clock components (hours, minutes, seconds) in this datetime's own calendar.protected static voidrequireResolution(DateTimeResolution granularity, DateTimeResolution floor, String source) Verifies that a requested resolution is no finer than the source's own precision, so a conversion does not fabricate digits the source cannot supply -- e.g.Renders the date in a long locale form using the calendar's own month names -- the Gregorian form, for example, is "January 31, 2020", and at month granularity "January 2020".Renders the time in a locale form.Renders the date in a short locale form, abbreviating the month name -- the Gregorian form is "31 Jan 2020", and at month granularity "Jan 2020".toString()Returns a string representation of this DateTime.toTime()Gets the time of day as aTime.Renders the time of day, or the empty string when this datetime has no time component (a granularity of a day or coarser).Methods inherited from class AbstractDateTime
coarsePeriodYears, definesUncertainty, getAeon, getAttoseconds, getCalendarType, getCentury, getDay, getEpoch, getFemtoseconds, getGranularity, getGranularityMultiplier, getHour, getMicroquectoseconds, getMicroseconds, getMillennium, getMilliquectoseconds, getMilliseconds, getMinute, getMonth, getNanoseconds, getPicoseconds, getPlanckseconds, getQuectoseconds, getRontoseconds, getSecond, getTimeType, getUncertaintyMinus, getUncertaintyPlus, getUncertaintyUnits, getYear, getYoctoseconds, getZeptoseconds, isUncertaintyDateInclusive, rawDay, referenceYearModifier and TypeMethodDescriptionprotected long[]Gets the first and last year of this value's coarse period.final booleanTests if uncertainty is defined for this time.final longgetAeon()Gets the aeon.final longGets the number of attoseconds of the femtoseconds 0-999.final TypeGets the calendar type.final longGets the century.final longgetDay()Gets the day of the month.final longgetEpoch()Gets the epoch.final longGets the number of femtoseconds of the picosecond 0-999.final DateTimeResolutionGets the granularity of this time.final longIf the granularity of the time equalsgetGranularity(),then the multiplier is 1.final longgetHour()Gets the hour of the day.final longGets the number of undaseconds of the vatosecond 0-999.final longGets the number of microseconds of the second 0-999.final longGets the millennium.final longGets the number of vatoseconds of the xoxxosecond 0-999.final longGets the number of milliseconds in this second 0-999.final longGets the minute of the hour.final longgetMonth()Gets the month.final longGets the number of nanoseconds of the microsecond 0-999.final longGets the number of picoseconds of the nanosecond 0-999.final longGets the number of Plancks of the vatoseconds.final longGets the number of weebleseconds of the xoxxosecond 0-999.final longGets the number of xoxxoseconds of the yoctosecond 0-999.final longGets the second of the minute.final TypeGets the time type.final longGets the uncertainty of this time in the negative direction.final longGets the uncertainty of this time in the positive direction.final DateTimeResolutionGets the units of the uncertainty.final longgetYear()Gets the year.final longGets the number of yoctoseconds of the picosecond 0-999.final longGets the number of zeptoseconds of the attosecond 0-999.booleanTests if the uncertainty is inclusive of all dates.protected final longrawDay()Gets the stored day of the month, ungated by granularity.protected longGets a year within this value's period, from which the coarser fields are derived.
-
Field Details
-
CALENDAR_TYPE
the OSID Type
-
-
Constructor Details
-
C360UTCDateTime
Constructs a newC360UTCDateTime.- Parameters:
specifier- a datetime specifier- Throws:
NullArgumentException-specifierisnull
-
-
Method Details
-
valueOf
Parses an ISO date string.- Parameters:
iso- the iso formatted string- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- could not parseisoNullArgumentException-isoisnull- See Also:
-
iso
Creates a DateTime from a strict ISO 8601 string. UnlikevalueOf(String), an uncertainty suffix or the"?"/"infinity"forms are not accepted.- Parameters:
iso- a strict ISO 8601 datetime string- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- cannot parseisoas a strict ISO datetimeNullArgumentException-isoisnull
-
datetime
Parses an ISO date string. Equivalent tovalueOf(String).- Parameters:
iso- the iso formatted string- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- could not parseisoNullArgumentException-isoisnull- See Also:
-
valueOf
Creates a DateTime at year resolution.- Parameters:
year- the year- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException-yearis invalid- See Also:
-
datetime
Creates a DateTime at year resolution.- Parameters:
year- the year- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException-yearis invalid- See Also:
-
valueOf
Creates a DateTime at month resolution.- Parameters:
year- the yearmonth- the month, from 1- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- a component is out of range- See Also:
-
datetime
Creates a DateTime at month resolution.- Parameters:
year- the yearmonth- the month, from 1- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- a component is out of range- See Also:
-
valueOf
Creates a DateTime at day resolution.- Parameters:
year- the yearmonth- the month, from 1day- the day, from 1- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- a component is out of range- See Also:
-
datetime
Creates a DateTime at day resolution.- Parameters:
year- the yearmonth- the month, from 1day- the day, from 1- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- a component is out of range- See Also:
-
valueOf
Creates a DateTime at a date and time. The time's resolution sets the datetime's resolution.- Parameters:
year- the yearmonth- the month, from 1day- the day, from 1time- the time of day (a UTC time)- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- a component is out of rangeUnsupportedException-timeis not a UTC timeNullArgumentException-timeisnull- See Also:
-
datetime
Creates a DateTime at a date and time. The time's resolution sets the datetime's resolution.- Parameters:
year- the yearmonth- the month, from 1day- the day, from 1time- the time of day (a UTC time)- Returns:
- a C360/UTC DateTime
- Throws:
InvalidArgumentException- a component is out of rangeUnsupportedException-timeis not a UTC timeNullArgumentException-timeisnull- See Also:
-
infinity
-
unknown
-