yuyu1025 commented on PR #1385:
URL: https://github.com/apache/commons-lang/pull/1385#issuecomment-2888459926

   > > I suppose the question is: Do we really need a utility method for:
   > > ```
   > > LocalDateTime.ofInstant(date.toInstant(), timeZone.toZoneId());
   > > ```
   > 
   > If you also consider 
[`java.sql.Date`](https://docs.oracle.com/en/java/javase/17/docs/api/java.sql/java/sql/Date.html)
 and 
[`java.sql.Timestamp`](https:docs.oracle.com/en/java/javase/17/docs/api/java.sql/java/sql/Timestamp.html)—both
 subclasses of `java.util.Date`—the conversion becomes less straightforward:
   > 
   > * `java.sql.Date.toInstant()` throws an exception.
   > * Instead, there are now dedicated methods: `java.sql.Date.toLocalDate()` 
and `java.sql.Timestamp.toLocalDateTime()`.
   > 
   > When you have to deal with legacy code that uses `Date`, having conversion 
helpers is quite useful.
   
   You raised a very good question, I have handled all subclasses and completed 
the unit tests, which will greatly improve efficiency for the development of 
projects involving both old and new systems.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to