org.threeten

bp

package bp

The main API for dates, times, instants, and durations.

The classes defined here represent the principal date-time concepts, including instants, durations, dates, times, time-zones and periods. They are based on the ISO calendar system, which is the de facto world calendar following the proleptic Gregorian rules. All the classes are immutable and thread-safe.

Each date time instance is composed of fields that are conveniently made available by the APIs. For lower level access to the fields refer to the org.threeten.bp.temporal package. Each class includes support for printing and parsing all manner of dates and times. Refer to the org.threeten.bp.format package for customization options.

The org.threeten.bp.chrono package contains the calendar neutral API. This is intended for use by applications that need to use localized calendars. It is recommended that applications use the ISO-8601 dates and time classes from this package across system boundaries, such as to the database or across the network. The calendar neutral API should be reserved for interactions with users.

Dates and Times

org.threeten.bp.Instant is essentially a numeric timestamp. The current Instant can be retrieved from a org.threeten.bp.Clock. This is useful for logging and persistence of a point in time and has in the past been associated with storing the result from java.lang.System#currentTimeMillis().

org.threeten.bp.LocalDate stores a date without a time. This stores a date like '2010-12-03' and could be used to store a birthday.

org.threeten.bp.LocalTime stores a time without a date. This stores a time like '11:30' and could be used to store an opening or closing time.

org.threeten.bp.LocalDateTime stores a date and time. This stores a date-time like '2010-12-03T11:30'.

org.threeten.bp.OffsetTime stores a time and offset from UTC without a date. This stores a date like '11:30+01:00'. The org.threeten.bp.ZoneOffset ZoneOffset is of the form '+01:00'.

org.threeten.bp.OffsetDateTime stores a date and time and offset from UTC. This stores a date-time like '2010-12-03T11:30+01:00'. This is sometimes found in XML messages and other forms of persistence, but contains less information than a full time-zone.

org.threeten.bp.ZonedDateTime stores a date and time with a time-zone. This is useful if you want to perform accurate calculations of dates and times taking into account the org.threeten.bp.ZoneId, such as 'Europe/Paris'. Where possible, it is recommended to use a simpler class. The widespread use of time-zones tends to add considerable complexity to an application.

Duration and Period

Beyond dates and times, the API also allows the storage of period and durations of time. A org.threeten.bp.Duration is a simple measure of time along the time-line in nanoseconds. A org.threeten.bp.Period expresses an amount of time in units meaningful to humans, such as years or hours.

Additional value types

org.threeten.bp.Year stores a year on its own. This stores a single year in isolation, such as '2010'.

org.threeten.bp.YearMonth stores a year and month without a day or time. This stores a year and month, such as '2010-12' and could be used for a credit card expiry.

org.threeten.bp.MonthDay stores a month and day without a year or time. This stores a month and day-of-month, such as '--12-03' and could be used to store an annual event like a birthday without storing the year.

org.threeten.bp.Month stores a month on its own. This stores a single month-of-year in isolation, such as 'DECEMBER'.

org.threeten.bp.DayOfWeek stores a day-of-week on its own. This stores a single day-of-week in isolation, such as 'TUESDAY'.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. bp
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. abstract class Clock extends AnyRef

    A clock providing access to the current instant, date and time using a time-zone.

  2. class DateTimeException extends RuntimeException

    Exception used to indicate a problem while calculating a date-time.

  3. final class DayOfWeek extends Enum[DayOfWeek] with TemporalAccessor with TemporalAdjuster

  4. final class Duration extends TemporalAmount with Ordered[Duration] with Serializable

    A time-based amount of time, such as '34.

  5. final class Instant extends TemporalAccessor with Temporal with TemporalAdjuster with Ordered[Instant] with Serializable

    An instantaneous point on the time-line.

  6. final class LocalDate extends ChronoLocalDate with Temporal with TemporalAdjuster with Serializable

    A date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03.

  7. final class LocalDateTime extends ChronoLocalDateTime[LocalDate] with Temporal with TemporalAdjuster with Serializable

    A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.

  8. final class LocalTime extends TemporalAccessor with Temporal with TemporalAdjuster with Ordered[LocalTime] with Serializable

    A time without time-zone in the ISO-8601 calendar system, such as 10:15:30.

  9. final class Month extends Enum[Month] with TemporalAccessor with TemporalAdjuster

  10. final class MonthDay extends TemporalAccessor with TemporalAdjuster with Ordered[MonthDay] with Serializable

    A month-day in the ISO-8601 calendar system, such as --12-03.

  11. final class OffsetDateTime extends Temporal with TemporalAdjuster with Ordered[OffsetDateTime] with Serializable

    A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00.

  12. final class OffsetTime extends TemporalAccessor with Temporal with TemporalAdjuster with Ordered[OffsetTime] with Serializable

    A time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 10:15:30+01:00.

  13. final class Period extends ChronoPeriod with Serializable

    A date-based amount of time, such as '2 years, 3 months and 4 days'.

  14. final class Ser extends Externalizable

    The shared serialization delegate for this package.

  15. final class Year extends TemporalAccessor with Temporal with TemporalAdjuster with Ordered[Year] with Serializable

    A year in the ISO-8601 calendar system, such as 2007.

  16. final class YearMonth extends TemporalAccessor with Temporal with TemporalAdjuster with Ordered[YearMonth] with Serializable

  17. abstract class ZoneId extends Serializable

    A time-zone ID, such as Europe/Paris.

  18. final class ZoneOffset extends ZoneId with TemporalAccessor with TemporalAdjuster with Ordered[ZoneOffset] with Serializable

    A time-zone offset from Greenwich/UTC, such as +02:00.

  19. final class ZoneRegion extends ZoneId with Serializable

    A geographical region where the same time-zone rules apply.

  20. final class ZonedDateTime extends ChronoZonedDateTime[LocalDate] with Temporal with Serializable

    A date-time with a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00 Europe/Paris.

Value Members

  1. object Clock

  2. object DayOfWeek extends Serializable

    A day-of-week, such as 'Tuesday'.

  3. object Duration extends Serializable

    Annotations
    @SerialVersionUID( 3078945930695997490L )
  4. object Instant extends Serializable

    Annotations
    @SerialVersionUID( 665713676816604388L )
  5. object LocalDate extends Serializable

    Annotations
    @SerialVersionUID( 2942565459149668126L )
  6. object LocalDateTime extends Serializable

    Annotations
    @SerialVersionUID( 6207766400415563566L )
  7. object LocalTime extends Serializable

    Annotations
    @SerialVersionUID( 6414437269572265201L )
  8. object Month extends Serializable

    A month-of-year, such as 'July'.

  9. object MonthDay extends Serializable

    Annotations
    @SerialVersionUID( 939150713474957432L )
  10. object OffsetDateTime extends Serializable

    Annotations
    @SerialVersionUID( 2287754244819255394L )
  11. object OffsetTime extends Serializable

    Annotations
    @SerialVersionUID( 7264499704384272492L )
  12. object Period extends Serializable

    Annotations
    @SerialVersionUID( 8290556941213247973L )
  13. object Year extends Serializable

    Annotations
    @SerialVersionUID( 23038383694477807L )
  14. object YearMonth extends Serializable

    A year-month in the ISO-8601 calendar system, such as 2007-12.

  15. object ZoneId extends Serializable

    Annotations
    @SerialVersionUID( 8352817235686L )
  16. object ZoneOffset extends Serializable

    Annotations
    @SerialVersionUID( 2357656521762053153L )
  17. object ZonedDateTime extends Serializable

    Annotations
    @SerialVersionUID( 6260982410461394882L )
  18. package chrono

    Support for calendar systems other than the default ISO.

  19. package format

    Provides classes to print and parse dates and times.

  20. package temporal

    Access to date and time using fields and units.

  21. package zone

    Support for time-zones and their rules.

Inherited from AnyRef

Inherited from Any

Ungrouped