Re: On Period and DateTimeFormatter

2025-06-19 Thread Stephen Colebourne
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 ver

Re: On Period and DateTimeFormatter

2025-06-18 Thread David Alayachew
I can certainly agree that there might have been a better name than Period. I like your suggestion, and I would even go further and suggest that Interval would have been a better term. But Period is certainly acceptable. It captures the meaning well enough -- a period of time between 2 events. ht

Re: On Period and DateTimeFormatter

2025-06-18 Thread Naoto Sato
Hi Pavel, On 6/18/25 4:29 AM, Pavel Rappo wrote: The second question is about DateTimeFormatter. I recently had to parse a date that resembles output of asctime: Sat Jul 16 02:03:55 + 1994. It's fine and dandy until you parse a date in September. That time format expects "Sep", while the for

Re: On Period and DateTimeFormatter

2025-06-18 Thread Archie Cobbs
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 Calendar

Re: On Period and DateTimeFormatter

2025-06-18 Thread Pavel Rappo
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

Re: On Period and DateTimeFormatter

2025-06-18 Thread David Alayachew
How does it not model an interval? Here is the official documentation. *Obtains a Period consisting of the number of years, months, and days between two dates.* https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/time/Period.html#between(java.time.LocalDate,java.time.LocalDate) An

On Period and DateTimeFormatter

2025-06-18 Thread Pavel Rappo
Hello, I have two questions on java.time API. The first one is about documentation for java.time.Period. When I get back to the API after a long period (no pun intended) of not using it, it takes me a while to recall that Period does __NOT__ model an interval between two specific points in time, s