0
点赞
收藏
分享

微信扫一扫

MySQL日期函数sysdate()与now()的区别,获取当前时间,日期相关函数

小云晓云 2023-11-28 阅读 35
select sleep(2) as datetime
union all	
select sysdate()  -- sysdate() 返回的时间是当前的系统时间,而 now() 返回的是当前的会话时间。
union all	
select now()   -- 等价于  localtime,localtime(),localtimestamp,localtimestamp(),current_timestamp,current_timestamp()
union all	
select concat(curdate(),' ',curtime())
union all	
select concat(date(now()),' ',time(now()))
union all	
select concat(year(now()),'-',month(now()),'-',day(now()),' ',hour(now()),':',minute(now()),':',second(now()))
union all 	
select dayname(now())
union all 	
select monthname(now());

在这里插入图片描述

举报

相关推荐

0 条评论