problem with datetime field
i have a php code like this:
date_default_timezone_set('GMT');
$date =date( "Y-m-d H:i:s");
echo $date;
output is
2011-05-01 11:31:49
but when inser开发者_如何学Ct $date in Datetime
column date is
2011-05-01 11:05:07
INSERT CODE:
date_default_timezone_set("GMT");
$date=date("Y-m-d H:m:s");
$q="insert into TABLE values
('$date')";
mysql_query($q);
why?
Your first example uses $date=date("Y-m-d H:i:s");
which seems ok.
Your second example uses $date=date("Y-m-d H:m:s");
which seems strange, you're using the month(m) in the conversion for minutes.
精彩评论