本文介绍了一年中的一周与一年中的一周中的ISO令牌(moment.js)之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究moment.js中的日期格式,并且遇到了以下这些标记: WoY和WoY ISO之间有什么显着区别吗?
I was studying date formating in moment.js and I came across these tokens: Is there any significant difference between WoY and WoY ISO?
一年中的一周
w - 1 2 ... 52 53 wo - 1st 2nd ... 52nd 53rd ww - 01 02 ... 52 53年度最佳(ISO)
W - 1 2 ... 52 53 Wo - 1st 2nd ... 52nd 53rd WW - 01 02 ... 52 53推荐答案
根据 Wikipedia , ISO周计数器从一年的第一个星期四开始;因此,如果一年的第一天是星期六,那么第一个星期四将在下周.
According to Wikipedia, the ISO week counter starts the first thursday of the year; so, if the first day of the year is saturday, the first thursday will be in the next week.
因此,第一个星期四的ISO周将是第一个星期,但是第一个星期四的标准周将是第二个星期,例如
Thus, the ISO week of the first thursday will be the first, but the standard week of the first thursday will be the second, e.g.
moment('2005-01-02').isoWeek(); // 53 moment('2005-01-02').week(); // 1 moment('2005-01-03').isoWeek(); // 1 moment('2005-01-03').week(); // 2致谢!
更多推荐
一年中的一周与一年中的一周中的ISO令牌(moment.js)之间的差异
发布评论