如何将时间戳附加到curdate()返回的mysql时间?

时间:2018-06-22 13:03:34

标签: mysql sql datetime

在Mysql中,我们有一个函数`

  

curdate()

`返回今天的日期。

即执行时

select curdate();

它返回日期为

  

2018-06-22

我想将时间戳记附加到该日期,例如

hh:mm:ss

我该怎么办?请帮助我。

我想查询带有时间戳的数据库。

类似的东西

select * from user where user_created_on >= (curdate() 00:00:00)

时间戳是

00:00:00.

2 个答案:

答案 0 :(得分:1)

select * from user where user_created_on >= getdate()

select * from user where user_created_on >= now()

这两个标签都将带有小时,分钟和秒的时间戳

ps:有一个curtime()可以得到时间戳记,而convert(varchar, curdate(), 108)也可以得到时间戳记:)

答案 1 :(得分:0)

仅连接时间部分:

SELECT * FROM user WHERE user_created_on >= CONCAT(CURDATE(), ' 00:00:00');
相关问题