作者:laknm_456 | 来源:互联网 | 2023-05-18 04:34
Myinitialapproachwas:我最初的做法是:$currenttime();savethistocolumnCURRENT_TIMEwithcolum
My initial approach was:
我最初的做法是:
$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);
I have come across the following approaches:
我遇到过以下方法:
- use
gmstrftime
to handle gmt
- 使用gmstrftime来处理gmt
- use
INT
instead of VARCHAR
for the column
- 对列使用INT而不是VARCHAR
- use the mysql function
CURTIME
or CURDATE
- 使用mysql函数CURTIME或CURDATE
- use the
UNIX_TIMESTAMP
mysql function
- 使用UNIX_TIMESTAMP mysql函数
none of which were using the DATETIME
or TIMESTAMP
mysql var type.
其中没有一个使用DATETIME或TIMESTAMP mysql var类型。
Do you have a better approach for this one?
你对这个有更好的方法吗?
5 个解决方案