Code example for Timestamp

Methods: getNanos, getTime

0
 
		@Override 
		public User mapRow(java.sql.ResultSet rs, int rowNum)
				throws SQLException { 
			Timestamp createdDate = rs.getTimestamp("created_date");
			long milliseconds = createdDate.getTime() + (createdDate.getNanos() / 1000000);
			User user = new User();
			 
			user.setId(rs.getInt("id"));
			user.setUserName(rs.getString("user_name"));
			user.setPassword(rs.getString("password"));
			user.setEnabled(rs.getInt("enabled"));
			user.setCreatedDate(new java.util.Date(milliseconds));
			 
			return user;
		} 
	} 
 
	 
 
}