I am looking at code that basically does the following:
ResultSet rs = ps.executeQuery(); String myDateStr = rs.getString("MY_DATE"); //field is of type Date SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'.0'"); Date myDate = sdf.parse(myDateStr);
In some environments, the last line works, and in others, an exception is thrown. It appears that on some systems the default date format is 2013-01-25 00: 00: 00.0 and others 2013-01-25 00:00:00. The JVM, OS, and Oracle versions are different between environments (everyone uses Oracle and runs on unix).
Changing the code can be tricky. I am wondering if there is an environment variable or similar that can be configured so that the date format is returned from the rs.getString () file?
source share