What's the recommended way to store current time using PHP and MySQL?

前端 未结 5 1408
时光说笑
时光说笑 2020-12-31 10:55

My initial approach was:

$current = time(); // save this to column CURRENT_TIME with column type VARCHAR

//retrieve it like this
$retrieved = mysql_query(..         


        
5条回答
  •  悲&欢浪女
    2020-12-31 11:33

    Well, you can turn a MySQL TIMESTAMP field into a PHP Time() value by using strtotime()

    Then you just have to make a function that correctly turns a PHP Time() value into a MySQL TIMESTAMP value.

提交回复
热议问题