Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How to convert and add mysql date format?

Asked by Al German Oct 3, 2022 560 views 1 answer
Share

About this question

 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 a prepared statement, executeBatch() to insert data to the table.

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.