+Tue Oct 17 15:35:00 BST 2000 petermount@maidstone.gov.uk
+ - Changed getTimestamp() again. This time Michael Stephenson's
+ <mstephenson@tirin.openworld.co.uk> solution looked far better
+ than the original solution put in June.
+
Tue Oct 10 13:12:00 BST 2000 peter@retep.org.uk
- DatabaseMetaData.supportsAlterTableWithDropColumn() as psql doesn't
support dropping of individual columns
- Removed the DriverClass kludge. Now the org.postgresql.Driver class
is compiled from a template file, and now has both the connection
class (ie jdbc1/jdbc2) and the current version's from Makefile.global
- -
Thu Jul 20 16:30:00 BST 2000 petermount@it.maidstone.gov.uk
- Fixed DatabaseMetaData.getTableTypes()
if(s==null)
return null;
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ // This works, but it's commented out because Michael Stephenson's
+ // solution is better still:
+ //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ // Michael Stephenson's solution:
+ SimpleDateFormat df = null;
+ if (s.length()>21 && s.indexOf('.') != -1) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
+ } else if (s.length()>19 && s.indexOf('.') == -1) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:MM:sszzz");
+ } else if (s.length()>19 && s.indexOf('.') != -1) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss.SS");
+ } else if (s.length()>10 && s.length()<=18) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
+ } else {
+ df = new SimpleDateFormat("yyyy-MM-dd");
+ }
try {
return new Timestamp(df.parse(s).getTime());
if(s==null)
return null;
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ // This works, but it's commented out because Michael Stephenson's
+ // solution is better still:
+ //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ // Michael Stephenson's solution:
+ SimpleDateFormat df = null;
+ if (s.length()>21 && s.indexOf('.') != -1) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
+ } else if (s.length()>19 && s.indexOf('.') == -1) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:MM:sszzz");
+ } else if (s.length()>19 && s.indexOf('.') != -1) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss.SS");
+ } else if (s.length()>10 && s.length()<=18) {
+ df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
+ } else {
+ df = new SimpleDateFormat("yyyy-MM-dd");
+ }
try {
return new Timestamp(df.parse(s).getTime());