import java.sql.*; import java.util.*; public class TS { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5830/jurka?loglevel=0","jurka",""); Timestamp ts = new Timestamp(System.currentTimeMillis()); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); System.out.println(ts); PreparedStatement pstmt = conn.prepareStatement("SELECT ?::timestamp, ?::timestamp"); pstmt.setTimestamp(1, ts); pstmt.setTimestamp(2, ts, cal); System.out.println(pstmt); ResultSet rs = pstmt.executeQuery(); rs.next(); System.out.println(rs.getString(1)); System.out.println(rs.getString(2)); Timestamp ts1 = rs.getTimestamp(1); Timestamp ts2 = rs.getTimestamp(2,cal); System.out.println(ts1); System.out.println(ts2); rs.close(); pstmt.close(); conn.close(); } }