Timeline for Find the earliest date among 3 dates
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 5 at 7:16 | comment | added | Anonymous | Java 8+ oneliner. Nit-picking, it needs to be wrapped in a varargs method as you show in order to fill the three values into an array. So I would not call it a one-liner. | |
Apr 5, 2021 at 10:02 | comment | added | Anonymous |
Date has caused innumerable time zone errors over the years. Hibernate 5 supports java.time just fine. jackson-modules-java8 too. Tastes differ.
|
|
Apr 5, 2021 at 7:51 | comment | added | pavelety |
@OleV.V. I prefer to use Date in most cases, because there is no issues to use it in DTO with Spring MVC (spring.jackson.serialization.write-dates-as-timestamps=true ), no timezone problems between JavaScript (Angular, React, etc) and Java using REST. In JS just use new Date(timeFromServer) without any parsers. You don't ever think about a timezone when Date comes from frontend and goes with Hibernate (also Date ) to database and vice versa. Also it perfectly works with Swagger (OpenAPI). It's very well supported by all new and old frameworks. New time API is perfect for time math.
|
|
Dec 21, 2019 at 14:21 | comment | added | Anonymous | * using Java 8 or higher | |
Dec 19, 2019 at 19:35 | review | Late answers | |||
Dec 19, 2019 at 19:52 | |||||
Dec 19, 2019 at 19:21 | comment | added | Anonymous |
If you are using Java or higher you should not use Date . That class is poorly designed and long outdated. Depending on exact requirements use Instant or another class from java.time, the modern Java date and time API. Even on Java 6 or 7 you may consider the same using ThreeTen Backport.
|
|
Dec 19, 2019 at 19:16 | history | answered | pavelety | CC BY-SA 4.0 |