Insert date and time into Mysql

Posted by Jerry on Stack Overflow See other posts from Stack Overflow or by Jerry
Published on 2010-05-28T14:56:01Z Indexed on 2010/05/28 15:01 UTC
Read the original article Hit count: 173

Filed under:
|
|
|
|

Hi..guys I am trying to insert date and time into mysql datetime field. When a user select a date and time, it will generate two POST variables. I have searched internet but still not sure how to do it.

My code.

//date value is 05/25/2010
//time value is 10:00

$date=$_POST['date'];
$time=$_POST['time'];

$datetime=$date.$time

If I insert $datetime into mysql, the date appears to be 0000-00-00:00:00:00

I appreciate it if anyone could help me about this. Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql