Skip to content

Commit

Permalink
add date formats
Browse files Browse the repository at this point in the history
  • Loading branch information
moovida committed Apr 27, 2024
1 parent 8093f6d commit 7b8ac66
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

import java.io.File;
import java.sql.Clob;
import java.sql.Date;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -379,6 +381,12 @@ public static boolean importFeatureCollection( ASpatialDb db, SimpleFeatureColle
} else if (object instanceof Clob) {
String string = ((Clob) object).toString();
pStmt.setString(iPlus, string);
} else if (object instanceof Date) {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
pStmt.setString(iPlus, dateFormatter.format(object));
} else if (object instanceof java.util.Date) {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
pStmt.setString(iPlus, dateFormatter.format(object));
} else {
pStmt.setString(iPlus, object.toString());
}
Expand Down

0 comments on commit 7b8ac66

Please sign in to comment.