File tree Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change
1
+ Tue Oct 17 15:35:00 BST 2000 petermount@maidstone.gov.uk
2
+ - Changed getTimestamp() again. This time Michael Stephenson's
3
+ <mstephenson@tirin.openworld.co.uk> solution looked far better
4
+ than the original solution put in June.
5
+
1
6
Tue Oct 10 13:12:00 BST 2000 peter@retep.org.uk
2
7
- DatabaseMetaData.supportsAlterTableWithDropColumn() as psql doesn't
3
8
support dropping of individual columns
@@ -13,7 +18,6 @@ Mon Sep 25 14:22:00 BST 2000 peter@retep.org.uk
13
18
- Removed the DriverClass kludge. Now the org.postgresql.Driver class
14
19
is compiled from a template file, and now has both the connection
15
20
class (ie jdbc1/jdbc2) and the current version's from Makefile.global
16
- -
17
21
18
22
Thu Jul 20 16:30:00 BST 2000 petermount@it.maidstone.gov.uk
19
23
- Fixed DatabaseMetaData.getTableTypes()
Original file line number Diff line number Diff line change @@ -462,7 +462,23 @@ public Timestamp getTimestamp(int columnIndex) throws SQLException
462
462
if (s ==null )
463
463
return null ;
464
464
465
- SimpleDateFormat df = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" );
465
+ // This works, but it's commented out because Michael Stephenson's
466
+ // solution is better still:
467
+ //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
468
+
469
+ // Michael Stephenson's solution:
470
+ SimpleDateFormat df = null ;
471
+ if (s .length ()>21 && s .indexOf ('.' ) != -1 ) {
472
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSzzz" );
473
+ } else if (s .length ()>19 && s .indexOf ('.' ) == -1 ) {
474
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:MM:sszzz" );
475
+ } else if (s .length ()>19 && s .indexOf ('.' ) != -1 ) {
476
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:MM:ss.SS" );
477
+ } else if (s .length ()>10 && s .length ()<=18 ) {
478
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:MM:ss" );
479
+ } else {
480
+ df = new SimpleDateFormat ("yyyy-MM-dd" );
481
+ }
466
482
467
483
try {
468
484
return new Timestamp (df .parse (s ).getTime ());
Original file line number Diff line number Diff line change @@ -465,7 +465,23 @@ public Timestamp getTimestamp(int columnIndex) throws SQLException
465
465
if (s ==null )
466
466
return null ;
467
467
468
- SimpleDateFormat df = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss" );
468
+ // This works, but it's commented out because Michael Stephenson's
469
+ // solution is better still:
470
+ //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
471
+
472
+ // Michael Stephenson's solution:
473
+ SimpleDateFormat df = null ;
474
+ if (s .length ()>21 && s .indexOf ('.' ) != -1 ) {
475
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSzzz" );
476
+ } else if (s .length ()>19 && s .indexOf ('.' ) == -1 ) {
477
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:MM:sszzz" );
478
+ } else if (s .length ()>19 && s .indexOf ('.' ) != -1 ) {
479
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:MM:ss.SS" );
480
+ } else if (s .length ()>10 && s .length ()<=18 ) {
481
+ df = new SimpleDateFormat ("yyyy-MM-dd HH:MM:ss" );
482
+ } else {
483
+ df = new SimpleDateFormat ("yyyy-MM-dd" );
484
+ }
469
485
470
486
try {
471
487
return new Timestamp (df .parse (s ).getTime ());
You can’t perform that action at this time.
0 commit comments