1<!-- 2/* 3 * Copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos 4 * 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * * Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright notice, 14 * this list of conditions and the following disclaimer in the documentation 15 * and/or other materials provided with the distribution. 16 * 17 * * Neither the name of JSR-310 nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 25 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33--> 34<body> 35 <p> 36 The main API for dates, times, instants, and durations. 37 </p> 38 <p> 39 The classes defined here represent the principal date-time concepts, 40 including instants, durations, dates, times, time-zones and periods. 41 They are based on the ISO calendar system, which is the <i>de facto</i> world 42 calendar following the proleptic Gregorian rules. 43 All the classes are immutable and thread-safe. 44 </p> 45 <p> 46 Each date time instance is composed of fields that are conveniently 47 made available by the APIs. For lower level access to the fields refer 48 to the {@link org.threeten.bp.temporal} package. 49 Each class includes support for printing and parsing all manner of dates and times. 50 Refer to the {@link org.threeten.bp.format} package for customization options. 51 </p> 52 <p> 53 The {@link org.threeten.bp.chrono} package contains the calendar neutral API. 54 This is intended for use by applications that need to use localized calendars. 55 It is recommended that applications use the ISO-8601 dates and time classes from 56 this package across system boundaries, such as to the database or across the network. 57 The calendar neutral API should be reserved for interactions with users. 58 </p> 59 60 <h4>Dates and Times</h4> 61 <p> 62 {@link org.threeten.bp.Instant} is essentially a numeric timestamp. 63 The current Instant can be retrieved from a {@link org.threeten.bp.Clock}. 64 This is useful for logging and persistence of a point in time 65 and has in the past been associated with storing the result 66 from {@link java.lang.System#currentTimeMillis()}. 67 </p> 68 <p> 69 {@link org.threeten.bp.LocalDate} stores a date without a time. 70 This stores a date like '2010-12-03' and could be used to store a birthday. 71 </p> 72 <p> 73 {@link org.threeten.bp.LocalTime} stores a time without a date. 74 This stores a time like '11:30' and could be used to store an opening or closing time. 75 </p> 76 <p> 77 {@link org.threeten.bp.LocalDateTime} stores a date and time. 78 This stores a date-time like '2010-12-03T11:30'. 79 </p> 80 <p> 81 {@link org.threeten.bp.OffsetTime} stores a time and offset from UTC without a date. 82 This stores a date like '11:30+01:00'. 83 The {@link org.threeten.bp.ZoneOffset ZoneOffset} is of the form '+01:00'. 84 </p> 85 <p> 86 {@link org.threeten.bp.OffsetDateTime} stores a date and time and offset from UTC. 87 This stores a date-time like '2010-12-03T11:30+01:00'. 88 This is sometimes found in XML messages and other forms of persistence, 89 but contains less information than a full time-zone. 90 </p> 91 <p> 92 {@link org.threeten.bp.ZonedDateTime} stores a date and time with a time-zone. 93 This is useful if you want to perform accurate calculations of 94 dates and times taking into account the {@link org.threeten.bp.ZoneId}, such as 'Europe/Paris'. 95 Where possible, it is recommended to use a simpler class. 96 The widespread use of time-zones tends to add considerable complexity to an application. 97 </p> 98 99 <h4>Duration and Period</h4> 100 <p> 101 Beyond dates and times, the API also allows the storage of period and durations of time. 102 A {@link org.threeten.bp.Duration} is a simple measure of time along the time-line in nanoseconds. 103 A {@link org.threeten.bp.Period} expresses an amount of time in units meaningful to humans, such as years or hours. 104 </p> 105 106 <h4>Additional value types</h4> 107 <p> 108 {@link org.threeten.bp.Year} stores a year on its own. 109 This stores a single year in isolation, such as '2010'. 110 </p> 111 <p> 112 {@link org.threeten.bp.YearMonth} stores a year and month without a day or time. 113 This stores a year and month, such as '2010-12' and could be used for a credit card expiry. 114 </p> 115 <p> 116 {@link org.threeten.bp.MonthDay} stores a month and day without a year or time. 117 This stores a month and day-of-month, such as '--12-03' and 118 could be used to store an annual event like a birthday without storing the year. 119 </p> 120 <p> 121 {@link org.threeten.bp.Month} stores a month on its own. 122 This stores a single month-of-year in isolation, such as 'DECEMBER'. 123 </p> 124 <p> 125 {@link org.threeten.bp.DayOfWeek} stores a day-of-week on its own. 126 This stores a single day-of-week in isolation, such as 'TUESDAY'. 127 </p> 128 129</body> 130