使用MySQL获取时间戳 [英] Getting timestamp using MySQL
本文介绍了使用MySQL获取时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用mysql查询获取当前时间戳?
How can I get the current timestamp using a mysql query?
推荐答案
取决于您要寻找的种类.
Depends on which kind you're looking for.
可以按如下方式检索当前的整数Unix时间戳(1350517005
):
The current integer Unix Timestamp (1350517005
) can be retrieved like so:
SELECT UNIX_TIMESTAMP();
MySQL通常将时间戳显示为日期/时间字符串.要获得其中之一,这些是您的基本选项(摘自MySQL日期和时间参考):
MySQL often displays timestamps as date/time strings. To get one of those, these are your basic options (from the MySQL Date & Time reference):
SELECT CURRENT_TIMESTAMP;
SELECT CURRENT_TIMESTAMP();
SELECT NOW();
这篇关于使用MySQL获取时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文