@@ -472,13 +472,35 @@ public Timestamp getTimestamp(int columnIndex) throws SQLException
472
472
//so this code strips off timezone info and adds on the GMT+/-...
473
473
//as well as adds a third digit for partial seconds if necessary
474
474
StringBuffer strBuf = new StringBuffer (s );
475
+
476
+ //we are looking to see if the backend has appended on a timezone.
477
+ //currently postgresql will return +/-HH:MM or +/-HH for timezone offset
478
+ //(i.e. -06, or +06:30, note the expectation of the leading zero for the
479
+ //hours, and the use of the : for delimiter between hours and minutes)
480
+ //if the backend ISO format changes in the future this code will
481
+ //need to be changed as well
475
482
char sub = strBuf .charAt (strBuf .length ()-3 );
476
483
if (sub == '+' || sub == '-' ) {
477
484
strBuf .setLength (strBuf .length ()-3 );
478
485
if (subsecond ) {
479
- strBuf = strBuf .append ('0' ).append ("GMT" ).append (s .substring (s .length ()-3 , s .length ())).append (":00" );
486
+ strBuf .append ('0' ).append ("GMT" ).append (s .substring (s .length ()-3 , s .length ())).append (":00" );
487
+ } else {
488
+ strBuf .append ("GMT" ).append (s .substring (s .length ()-3 , s .length ())).append (":00" );
489
+ }
490
+ } else if (sub == ':' ) {
491
+ //we may have found timezone info of format +/-HH:MM, or there is no
492
+ //timezone info at all and this is the : preceding the seconds
493
+ char sub2 = strBuf .charAt (strBuf .length ()-5 );
494
+ if (sub2 == '+' || sub2 == '-' ) {
495
+ //we have found timezone info of format +/-HH:MM
496
+ strBuf .setLength (strBuf .length ()-5 );
497
+ if (subsecond ) {
498
+ strBuf .append ('0' ).append ("GMT" ).append (s .substring (s .length ()-5 ));
480
499
} else {
481
- strBuf = strBuf .append ("GMT" ).append (s .substring (s .length ()-3 , s .length ())).append (":00" );
500
+ strBuf .append ("GMT" ).append (s .substring (s .length ()-5 ));
501
+ }
502
+ } else if (subsecond ) {
503
+ strBuf .append ('0' );
482
504
}
483
505
} else if (subsecond ) {
484
506
strBuf = strBuf .append ('0' );
0 commit comments