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

前端 未结 5 1396
时光说笑
时光说笑 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:42

    Storing it as int is more logical. You save the row format of date, using which you can later extract other format and more data .. I also save it as int.

    Edit: For(Uni-TimeZone) application int is the fastest way and PHP has great time conversion tools.

提交回复
热议问题