Skip to content

Instantly share code, notes, and snippets.

@darbyluv2code
Last active March 31, 2017 00:53
Show Gist options
  • Save darbyluv2code/5f01514ad256b26bfa54c7b902a0ea0e to your computer and use it in GitHub Desktop.
Save darbyluv2code/5f01514ad256b26bfa54c7b902a0ea0e to your computer and use it in GitHub Desktop.
String sql = "INSERT INTO employees (last_name, first_name, checkout_time) values (?, ?, ?)";
PreparedStatement myStmt = myConn.prepareStatement(sql);
...
java.util.Date now = new java.util.Date();
java.sql.Timestamp currentTimetamp = new java.sql.Timestamp(now.getTime());
myStmt.setTimestamp(3, currentTimestamp);
myStmt.executeUpdate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment