如何使用php在mysql中插入datetime

i am currently creating an application. I have created a form where the user is able to choose a year,month,day,hour and minute. I was wondering how to insert this into my sql database. Thanks

code for the form-

           <select name="day" id="day">
 <?php
for($i=1;$i<=31;$i++) 
{
echo "<option>" . $i . "</option>";
}
?>
</select>
<td>
<select name="month" id="month">

  <?php
for($i=1;$i<=12;$i++) 
{
echo "<option>" . $i . "</option>";
}
?>
</select>
<td>

<select name="year" id="year">
  <?php
for($i=2015;$i<=2016;$i++) 
{
echo "<option>" . $i . "</option>";
}
?>
  <td>
  </select>

    <select name="Hour" id="hour">
 <?php
for($i=0;$i<=23;$i++) 
{
echo "<option>" . sprintf("%02d",$i) . "</option>";
}
?>

</select>
<td>
<select name="minute">
<?php
for($i=0;$i<=60;$i++) 
{
echo "<option>" . sprintf("%02d",$i) . "</option>";
}
?>
</select>

You put this in a form(read everything from this link) and then use $_POST['day'] etc and use an insert query to put it in the database. I wont say too much about this since I wouldn't recommend doing it like this at all.

You're checking the days of the month. If it has less than 31 days in it, it's valid. < This is not true. Not all the dates are valid if it has less than 31 days in it. There's ways to do this which already exist. It's so much easier. PHP datetime. You can also validate most with the datetime type in mysql. I'd recommend you to read through all of the links.