Default JDBC date format when reading date as a string from ResultSet

前端 未结 4 1486
鱼传尺愫
鱼传尺愫 2020-12-17 01:37

I\'m looking at some code that basically does the following:

ResultSet rs = ps.executeQuery();
String myDateStr = rs.getString(\"MY_DATE\"); //field is of ty         


        
4条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 02:39

    If the field is of type Date, then read it as a java.sql.Date and do whatever conversion you need after that. Otherwise you're at the mercy of the database implementation.

提交回复
热议问题