Hi I am triying to save a date input from a form to mysql db. The problem is my date input is in the form
"dd/mm/yyyy" but when i try to save that to my db it is stored as "yyyy-mm-dd"
for eg: 15/12/2005 is stored as 2015-12-20 .
Im a newbie here so please somebody help me to format the date before storing it.
Use strtotime() to convert it to a timestamp, and then date() to output the proper format:
$myinput='12/15/2005'; $sqldate=date('Y-m-d',strtotime($myinput));
Note, this won't trap any errors - that is left as an exercise to the reader.
Thank you so much 🙂 Let me try it out .... There is no problem of tracking error because i am using a calender ... so no manual entry is allowed😉