如何使用 javascript 找到某一天属于星期几?
我想在 javascript 中找到一天属于星期几。我对周的定义是截至该日期为止的星期六数。所以一月份的前几天算上一年的最后一周。从那里开始,第一个星期六到前一个星期五是第 0 周(基于 0 的周计数)。
有人知道如何实现这样的功能吗?
I want to find the number of the week which a day belongs to in javascript. My definition of week is the number of saturdays there have been up to that date. So the first few days of january are counted as the final week of the previous year. From there, the first saturday to the preceding friday is week 0 (0 based week counting).
Anyone know how to implement a function like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这?
This?
查看 http://www.datejs.com/
Checkout http://www.datejs.com/
最后,我选择了:
这消除了 UTC 偏移量的问题
In the end, I went for:
Which removes problems with UTC offsets