MySQL-function-unix_timestamp

来源:互联网 发布:bluestack for mac 编辑:程序博客网 时间:2024/06/05 02:16

获取现在之前插入数据库中的数据。 比如数据库中有一个字段 sendtime, 赋值通过time()函数。数据库一直在更新,想获取现在之前插入的记录。

time()函数:

time — Return current Unix timestamp

我们直接在sql中使用unix_timestamp()函数就可以了,比如

select * from shop sendtime < unix_timestamp();

使用 from_unixtime(unix_timestamp())可以将秒转换成日期的形式,可以指定日期的格式。

参考地址:http://blog.csdn.net/lxpbs8851/article/details/8604747

0 0
原创粉丝点击