[英]Use the UNIX epoch in a mysql column?
A column in one of my tables is DATE and currently it gets automatically filled with a timestamp of when the row was made. 我的一个表中的一列是DATE,当前会自动填充该行创建的时间戳。 The timestamp looks like 2013-02-10 19:56:12. 时间戳看起来像2013-02-10 19:56:12。 Is there anyway I can have it timestamp with the unix epoch automatically? 无论如何,我可以自动使用unix纪元为其添加时间戳吗? I hope this makes sense. 我希望这是有道理的。 I'm still a beginner when it comes to mysql. 关于mysql,我还是一个初学者。
if you want to project ( select ) TIMESTAMP
into UNIX
format, use UNIX_TIMESTAMP(date)
如果要将TIMESTAMP
投影 ( 选择 )为UNIX
格式,请使用UNIX_TIMESTAMP(date)
SELECT UNIX_TIMESTAMP(date)
FROM tableName
您可以在检索数据时使用unix_timestamp函数:
SELECT unix_timestamp(timestampColumn)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.