Insert date and time to DATETIME [closed]

0

I have a date and time with the following value: 2017-01-27_12-52-00-9370 What I need is to insert it into the database with the DATETIME data type Thanks.

    
asked by R.Priego 30.01.2017 в 10:04
source

1 answer

1

Use java.sql.Timestamp to be able to save the date more accurately:

java.util.Date date = new Date(); //Tu fecha a guardar
tuPreparedStatement.setTimestamp(columIndex, new java.sql.Timestamp(date.getTime()));
    
answered by 30.01.2017 в 10:56