Converting java date to Sql timestamp

You can cut off the milliseconds using a Calendar: java.util.Date utilDate = new java.util.Date(); Calendar cal = Calendar.getInstance(); cal.setTime(utilDate); cal.set(Calendar.MILLISECOND, 0); System.out.println(new java.sql.Timestamp(utilDate.getTime())); System.out.println(new java.sql.Timestamp(cal.getTimeInMillis())); Output: 2014-04-04 10:10:17.78 2014-04-04 10:10:17.0

How to convert LocalDate to SQL Date Java?

The answer is really simple; import java.sql.Date; … LocalDate locald = LocalDate.of(1967, 06, 22); Date date = Date.valueOf(locald); // Magic happens here! r.setDateOfBirth(date); If you would want to convert it the other way around, you do it like this: Date date = r.getDate(); LocalDate localD = date.toLocalDate(); r is the record you’re using in JOOQ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)