<story><title>Arrow v1.0: After 8 years, even better dates and times for Python</title><url>https://github.com/arrow-py/arrow</url></story><parent_chain><item><author>kuschku</author><text>The only working datetime solution is JSR310.&lt;p&gt;It has separate types for&lt;p&gt;• LocalTime (milliseconds after midnight)&lt;p&gt;• LocalDate (julian day),&lt;p&gt;• LocalDateTime (julian day and milliseconds after midnight),&lt;p&gt;• Instant (nanoseconds since EPOCH),&lt;p&gt;• ZonedDateTime (which is a point in time with a timezone, and exposes both the localdatetime and the instant APIs)&lt;p&gt;All of these types have a reason to exist, and definitely shouldn&amp;#x27;t be mixed together (like python does).&lt;p&gt;• If I program an alarm clock, I&amp;#x27;ll want to use LocalTime. Even if DST starts&amp;#x2F;ends, you still wanna get woken up at 8am.&lt;p&gt;• My birthday is a LocalDate. It usually has no time information, and usually isn&amp;#x27;t depending on a timezone. An anniversary is the same.&lt;p&gt;• The moment when a loggable event happened is an Instant. The event doesn&amp;#x27;t care about timezones, only the exact time it happened.&lt;p&gt;• A calendar event is a ZonedDateTime: the meeting will happen at 10am CET, regardless of which timezone I&amp;#x27;m in at that point.&lt;p&gt;All these types describe different concepts, and they shouldn&amp;#x27;t be mixed together. Every language should adopt JSR310. Yes, it&amp;#x27;s relatively complicated, but it&amp;#x27;s extremely precise and accurate.&lt;p&gt;And you can convert them all!&lt;p&gt;•LocalDate + LocalTime becomes LocalDateTime&lt;p&gt;• LocalDateTime.atZone(ZoneId or ZoneOffset) becomes ZonedDateTime&lt;p&gt;• Instant.atZone(ZoneId or ZoneOffset) becomes ZonedDateTime&lt;p&gt;• ZonedDateTime.toInstant() or ZonedDateTime.toLocalDateTime() exposes local datetime and instant.&lt;p&gt;• LocalDate can easilybe converted to JapaneseDate, HebrewDate, ArabicDate.</text></item></parent_chain><comment><author>dwohnitmok</author><text>JSR 310&amp;#x27;s Instant class and notion of absolute time has always left me wondering whether any time library in any language attempts to handle relativity. Does anybody know of any?</text></comment>
<story><title>Arrow v1.0: After 8 years, even better dates and times for Python</title><url>https://github.com/arrow-py/arrow</url></story><parent_chain><item><author>kuschku</author><text>The only working datetime solution is JSR310.&lt;p&gt;It has separate types for&lt;p&gt;• LocalTime (milliseconds after midnight)&lt;p&gt;• LocalDate (julian day),&lt;p&gt;• LocalDateTime (julian day and milliseconds after midnight),&lt;p&gt;• Instant (nanoseconds since EPOCH),&lt;p&gt;• ZonedDateTime (which is a point in time with a timezone, and exposes both the localdatetime and the instant APIs)&lt;p&gt;All of these types have a reason to exist, and definitely shouldn&amp;#x27;t be mixed together (like python does).&lt;p&gt;• If I program an alarm clock, I&amp;#x27;ll want to use LocalTime. Even if DST starts&amp;#x2F;ends, you still wanna get woken up at 8am.&lt;p&gt;• My birthday is a LocalDate. It usually has no time information, and usually isn&amp;#x27;t depending on a timezone. An anniversary is the same.&lt;p&gt;• The moment when a loggable event happened is an Instant. The event doesn&amp;#x27;t care about timezones, only the exact time it happened.&lt;p&gt;• A calendar event is a ZonedDateTime: the meeting will happen at 10am CET, regardless of which timezone I&amp;#x27;m in at that point.&lt;p&gt;All these types describe different concepts, and they shouldn&amp;#x27;t be mixed together. Every language should adopt JSR310. Yes, it&amp;#x27;s relatively complicated, but it&amp;#x27;s extremely precise and accurate.&lt;p&gt;And you can convert them all!&lt;p&gt;•LocalDate + LocalTime becomes LocalDateTime&lt;p&gt;• LocalDateTime.atZone(ZoneId or ZoneOffset) becomes ZonedDateTime&lt;p&gt;• Instant.atZone(ZoneId or ZoneOffset) becomes ZonedDateTime&lt;p&gt;• ZonedDateTime.toInstant() or ZonedDateTime.toLocalDateTime() exposes local datetime and instant.&lt;p&gt;• LocalDate can easilybe converted to JapaneseDate, HebrewDate, ArabicDate.</text></item></parent_chain><comment><author>dthul</author><text>If I&amp;#x27;m not mistaken &amp;quot;chrono&amp;quot;[1] behaves almost the same.
It calls Local[Date|Time|DateTime] Naive[Date|Time|DateTime]. ZonedDateTime is just called DateTime. It doesn&amp;#x27;t have a separate type for Instants but can convert (zoned) DateTimes to and from UNIX timestamps.&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.rs&amp;#x2F;chrono&amp;#x2F;0.4.19&amp;#x2F;chrono&amp;#x2F;index.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.rs&amp;#x2F;chrono&amp;#x2F;0.4.19&amp;#x2F;chrono&amp;#x2F;index.html&lt;/a&gt;&lt;p&gt;Edit: it seems like chrono&amp;#x27;s design took lessons learned from other time libraries, including JSR-310, into account, so that explains why they are so similar.</text></comment>