[英]mysql: date_format converts the first week of 2016 into the last week
mysql将2016年的第一周(实际上是2015年的第53周)转换为2016年的第53周。 如何将其转换为实际周,即2015年的第53周? http://www.epochconverter.com/weeks/2016
select date_format('2016-01-03 09:16:18','%y-%v');
16-53
采用
select yearweek('2016-01-03',1);
第二个参数是weekmode,值1表示从星期一开始的几周。
要么
SELECT date_format( '2016-01-03 09:16:18', '%x-%v' )
%x表示星期从星期一开始
此处参考: http : //dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.