我最初的方法是:
$current = time(); // save this to column CURRENT_TIME with column type VARCHAR
//retrieve it like this
$retrieved = mysql_query(....) //assume query for getting the stored time value
$time = strtotime($retrieved);
我遇到了以下方法:
- 用于
gmstrftime
处理 GMT - 使用
INT
而不是VARCHAR
列 - 使用 mysql 函数
CURTIME
或CURDATE
- 使用
UNIX_TIMESTAMP
mysql函数
其中没有一个使用DATETIME
or TIMESTAMP
mysql var 类型。
您对此有更好的方法吗?