简体   繁体   English

如何在JavaScript中获得ISO 8601周的开始和结束日期时间?

[英]How to get start and end Datetime of ISO 8601 week in JavaScript?

If I have the Year (say 2013) and the ISO week (say 35), how do I get the Starting and Ending DateTime in pure JavaScript? 如果我有年份(比如2013)和ISO周(比如35),我如何在纯JavaScript中获得开始和结束日期时间?

Is there any specific Library for dealing with DateTime in JavaScript? 是否有任何特定的库来处理JavaScript中的DateTime?

As far as a library, there is http://www.datejs.com/ . 至于图书馆,有http://www.datejs.com/ Or http://phpjs.org/functions/date/ . http://phpjs.org/functions/date/

Try 尝试

var date  = new Date('01 Jan ' + year);
date.setDate(35 * 7);
date.setDate(date.getDate() - date.getDay()) //it will give the start of the week

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 给定 ISO 8601 日期/时间,如何使用 JS date() 获取星期几(0-6)? - Given a ISO 8601 date/time, how to use JS date() to get the day of the week (0-6)? 鉴于ISO 8601周数,您将如何获得该周内的日期 - Given a ISO 8601 weeknumber, how would you get the dates within that week 在 Javascript 中获取周一开始和周日结束的一周开始和结束 - Get start and end of week with the start on Monday and end on Sunday in Javascript 如何在JavaScript中获得周末? - How to get end of week in javascript? ISO 8601 中的日期时间和 javascript 中的 UTC 格式有什么区别? - What's the difference between datetime in ISO 8601 and UTC formats in javascript? 将ISO 8601字符串转换为Javascript中的当前TimeZone DateTime对象 - Converting an ISO 8601 string to Current TimeZone DateTime Object in Javascript 如何将带有时区的ISO 8601转换为C#日期时间? - How to convert ISO 8601 with timezone to C# Datetime? 使用纯JavaScript获取下周的开始和结束日期 - Get next week's start and end date using pure javascript 如何从 javascript 中的 ISO 8601 时间格式中获取时间? - How can I get time from ISO 8601 time format in javascript? 如何在javascript中使用ICU-string获取ISO8601演示日期? - How to get ISO8601-presentation for date using ICU-string in javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM