MySQL Trigger format convert dd/mm/yyyy to yyyy-mm-dd

  mysql, phpmyadmin, triggers

I have a table with the date field (event_date) with the corresponding format (yyyy-mm-dd), but the field I want to insert comes from a calendar with format dd/mm/yyyy.

I have created the following trigger in phpMyAdmin to change the format of that value:

enter image description here

But at the moment of executing the insert, the error continues in the same field.

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '02/11/2021' for column `prod`.`reserves`.`event_date` at row 1 (SQL: insert into `reserves` (`experience_id`, `reserve_state_id`, `name`, `email`, `phone`, `number_person`, `event_date`, `comment`, `updated_at`, `created_at`) values (98, 1, Nicolas, [email protected], ?, ?, 02/11/2021, ?, 2021-10-23 09:34:59, 2021-10-23 09:34:59))

Changing the calendar format is not a possibility, it must be possible to solve it with the trigger.

Source: PHPMYADMIN

LEAVE A COMMENT