SELECT
DATE_FORMAT(
str_to_date(
now(),
‘%Y-%m-%d %k:%i:%s’
),
‘%Y-%m-%d’
) AS ‘now day’,
CONCAT_WS(
‘-’,
from_unixtime(
UNIX_TIMESTAMP(
str_to_date(
now(),
‘%Y-%m-%d %k:%i:%s’
)
) - WEEKDAY(
str_to_date(
now(),
‘%Y-%m-%d %k:%i:%s’
)
) * 86400,
‘%m.%d’
),
from_unixtime(
UNIX_TIMESTAMP(
str_to_date(
now(),
‘%Y-%m-%d %k:%i:%s’
)
) + (
7 - (
WEEKDAY(
str_to_date(
now(),
‘%Y-%m-%d %k:%i:%s’
)
) + 1
)
) * 86400,
‘%m.%d’
)
) AS ‘target day’
mysql 日期转成 从几号到几号,记录一下,参考的 feifeichongtian(作者)
最新推荐文章于 2022-06-03 10:07:05 发布