请问如何给MySQL数据库传递DATETIME数据?我用的date("Y-N-d H:i:s",time())不行。

解决方案 »

  1.   


    mysql> desc t;
    +-------+----------+------+-----+---------+-------+
    | Field | Type     | Null | Key | Default | Extra |
    +-------+----------+------+-----+---------+-------+
    | dt    | datetime | YES  |     | NULL    |       |
    +-------+----------+------+-----+---------+-------+
    1 row in set (0.03 sec)
    mysql_query("insert into t values('".date("Y-m-d H:i:s",time())."')");注意日期类型插入数据库中要用''括起。
      

  2.   

    ISO标准时间格式
    2009-01-01 01:01:01