手机自建网站,进一步优化,企业网站建设的基本原则,北京市建设官方网站目录 current_timestamp()获取当前时间unix_timestamp()获取当前时区的UNIX时间戳from_unixtime()时间戳转日期函数unix_timestamp(string date)日期转时间戳函数提取日期中的年月日时分秒weekofyear (string date)日期转周函数日期比较函数datediff(string enddate, string st… 目录 current_timestamp()获取当前时间unix_timestamp()获取当前时区的UNIX时间戳from_unixtime()时间戳转日期函数unix_timestamp(string date)日期转时间戳函数提取日期中的年月日时分秒weekofyear (string date)日期转周函数日期比较函数datediff(string enddate, string startdate)日期增加/减少函数 current_timestamp()获取当前时间
select current_timestamp();输出2023-11-23 11:31:31.531
unix_timestamp()获取当前时区的UNIX时间戳
select unix_timestamp();输出1700710598
from_unixtime()时间戳转日期函数
select from_unixtime(1700710598);输出2023-11-23 11:36:38
unix_timestamp(string date)日期转时间戳函数
select unix_timestamp(2023-11-23 11:36:38);输出1700710598
提取日期中的年月日时分秒 select year(current_timestamp());输出2023
select month(current_timestamp());输出11
select day(current_timestamp());输出23
select hour(current_timestamp());输出13
select minute(current_timestamp());输出39
select second(current_timestamp());输出25
weekofyear (string date)日期转周函数
select weekofyear(current_timestamp());输出47
日期比较函数datediff(string enddate, string startdate)
select datediff(current_timestamp(),2023-11-20);输出3
日期增加/减少函数 date_add(string startdate, int days) date_sub (string startdate, int days) select date_add(current_timestamp(),3);输出2023-11-26
select date_sub(current_timestamp(),3);输出2023-11-20