On Period and DateTimeFormatter
Stephen Colebourne
scolebourne at joda.org
Thu Jun 19 10:52:04 UTC 2025
The term "Period" derives from early versions of ISO-8601. You will
note that the standard ISO-8601 format for Period is P1Y2M3D, where
the "P" stands for "Period".
The spec has changed over time. The original 1998 version [1] is where
Joda-Time, and thus Java-Time derive their names. The 2016 version [2]
has different terminology.
* Period - a descriptive quantity of time based on fields (from years
to seconds in Joda-Time, from years to days in Java-Time)
* Duration - a precise quantity of time based on seconds
* Interval - a section of the time-line specified by the start and end
instants (not in Java-Time ATM)
Stephen
[1] https://www.webaugur.com/bibliotheca/standards/iso8601/8601.pdf
[2] https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf
On Wed, 18 Jun 2025 at 18:54, Archie Cobbs <archie.cobbs at gmail.com> wrote:
>
> Period is like Duration - they are both "lengths of time", just using different units (so they are both a TemporalAmount).
>
> Similar to how LocalDateTime vs. Instant are both "points in time", just using different units (so they are both a Temporal).
>
> But you bring up a good point - perhaps CalendarDuration would have been a better name than Period...
>
> -Archie
>
> On Wed, Jun 18, 2025 at 12:24 PM Pavel Rappo <pavel.rappo at gmail.com> wrote:
>>
>> We are talking about a period, not an interval. I used the word
>> "interval" in my previous email in the sense close to that def. #5
>> from your dictionary link:
>>
>> > : a set of real numbers between two numbers either including or excluding one or both of them
>>
>> So to me, an interval between two dates logically consists of all
>> (time) instants between its both ends.
>>
>> Alright, your reply kinda tips the scales in favour of "it's just me".
>> Perhaps others don't have a similar issue with java.util.Period.
>
>
> --
> Archie L. Cobbs
More information about the core-libs-dev
mailing list