Q:

change the format of the date inserted by PHP into MySQL database

I am trying to insert the current date into MySQL database in this format: (12/31/2013 10:26:12 PM). I've tried to make a simple code to change the format, but all I get is a syntax error
$sql = "INSERT INTO Students
 VALUES
  ('','" . $info[$i]['firstname'] . "', '" . $info[$i]['lastname'] . "',
 '" . $info[$i]['sex'] . "', '" . $info[$i]['major'] . "',
 '" . $info[$i]['favorite'] . "', '" . $info[$i]['GPA']
 "TO_CHAR(SYSDATE(),'dd/mm/yyyy')"; 

Tell me please what shall I do with it.

A:

Just try this
$sql = "INSERT INTO Students VALUES ('','" . $info[$i]['firstname'] . "', '" . $info[$i]['lastname'] . "', '" . $info[$i]['sex'] . "', '" . $info[$i]['major'] . "', '" . $info[$i]['favorite'] . "', '" . $info[$i]['GPA'] . gmdate('m/d/Y g:i:s A').")";

or try this one
$sql = "INSERT INTO Students VALUES ('','" . $info[$i]['firstname'] . "', '" . $info[$i]['lastname'] . "', '" . $info[$i]['sex'] . "', '" . $info[$i]['major'] . "', '" . $info[$i]['favorite'] . "', '" . $info[$i]['GPA'] ."', '" . gmdate('m/d/Y g:i:s A').")";

You can also change gmdate with date
Have A nice day 

