一年中的一周与一年中的一周中的ISO令牌(moment.js)之间的差异

编程入门 行业动态 更新时间:2024-10-23 13:32:13
本文介绍了一年中的一周与一年中的一周中的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)之间的差异

本文发布于:2023-10-28 23:29:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538081.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:年中   令牌   差异   ISO   moment

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!