Intercept Date Fields on save

I am using the built in JQuery datepicker on some of my controls in my view and I would like them to display as mm-dd-yyyy but mysql expects them in a different format which causes an error. How to solve this?

I ended up using the altformat and altfield properties of the datepicker module and this seems to be working

You can handle this with the beforeMarshal event in cakephp see: https://book.cakephp.org/3.0/en/orm/saving-data.html#before-marshal

You could also use mysqls STR_TO_DATE which i don’t reccomend: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_str-to-date

Or you could transform your data on the client side with altForm: http://api.jqueryui.com/datepicker/#option-altFormat

The last one you mentioned is the one I ended up doing Thanks so much