1853. 转换日期格式 https://leetcode.cn/problems/convert-date-format/ SQL: SELECT concat(dayname(day), ', ', monthname(day), ' ', day(day), ', ', year(day)) AS day FROM Days 结果
SELECT
CASE
DATE_FORMAT(NOW(),'%w')
WHEN 1 THEN '星期一'
WHEN 2 THEN '星期二'
WHEN 3 THEN '星期3'
WHEN 4 THEN '星期4'
WHEN 5 THEN '星期五'
WHEN 6 THEN '星期6'
WHEN 7 THEN '星期日'
END
as week
mysql> select dayname('20200905');
+---------------------+
| dayname('20200905') |
+---------------------+
| Saturday |
+---------------------+