Sample Header Ad - 728x90

Convert Date format to insert into MySQL database

3 votes
2 answers
4370 views
I'm receiving the date in '**Sun Jun 20 00:40:27 IST 2021**' format. Which I need to insert to my MySQL database in datetime(6) format. I used STR_TO_DATE('Sun Jun 20 00:40:27 IST 2021','%d/%m/%Y %T') and received > Incorrect datetime value: 'Sun Jun 20 00:40:27 IST 2021' for function > str_to_date error. I also tried date_format('Sun Jun 20 00:40:27 IST 2021','%d/%m/%Y %T') and received > Incorrect datetime value: 'Sun Jun 20 00:40:27 IST 2021 Can anyone guide me to fix it? PS: I'm using prepared statement, executeBatch() to insert data to table.
Asked by RDD (33 rep)
Mar 22, 2022, 04:40 PM
Last activity: Aug 24, 2022, 05:21 PM