![]() ![]() ![]() The java.time framework is built into Java 8 and later. LocalDate ld = myResultSet.getObject( …, LocalDate.class ) You should be writing a LocalDate object to a column of a type akin to the SQL-standard type DATE. You can exchange java.time object with your database as of JDBC 4.2 and later. The java.time classes use those formats by default when parsing/generating strings. Your input string is in standard ISO 8601 format. ![]() Those legacy classes were supplanted years ago by the modern java.time classes. Sun, Oracle, and the JCP community gave up on those classes years ago, and so should you. Avoid them, along with SimpleDateFormat etc. Never use Dateīoth the class and class are terrible, flawed in design, written by people who did not understand date-time handling. That class represents a moment, a date with time-of-day as seen in UTC.Īdding to the confusion is that its toString method dynamically applies the JVM’s current default time zone. One of many flaws in the class is its name. Tl dr tObject( …, LocalDate.parse( "" ) ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |