sql 时间

sql拿两天之内的时间

SELECT * FROM room_message WHERE send_date BETWEEN UNIX_TIMESTAMP( now())-172800 AND now() ;(172800是从1970-01-01 08:00:00到时间的相隔的秒数)

select * FROM room_message WHERE send_date BETWEEN now() - interval 2 DAY and now()

sql   date_format(created_at,'') 常用

%T   =  '%H:%i:%s'   24小时制时分秒

DATE()  =  %Y-%m-%d  年月日

extract(month from created_at) 截取当中的月份格式   quarter 季度
 
当前日期
now()
curdate()
curtime()

posted on 2022-12-01 19:50  吴XX  阅读(49)  评论(0)    收藏  举报