OP可能有一个应用程序,其中Weeks运行Sun..Sat,如 祈祷书。但是他的电子邮件地址表明他在一个国家/地区的价格是星期一,星期一,太阳,通常使用的价格为b $ b。 他应该考虑是否代码可以在另一个国家执行, 然后会发生什么。 - (c)John Stockton ,萨里,英国。 ?@merlyn.demon.co.uk Turnpike v6.05 IE 6 news:comp.lang.javascript FAQ< URL:http://www.jibbering.com/faq/index.html> ;。 < URL:http://www.merlyn.demon.co.uk/js-index.htmjscr数学,日期,来源。 < URL :http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/& c,常见问题项目,链接。 Dear All,I am trying to make a script that prints a date in the format Sunday14th January 2007. Where the date that is displayed is the next sunday3 weeks from now. For example today is 7th January. The script wouldprint Sunday 28th January 2007. It would read that all of this weekuntil next sunday when it would change to Sunday 4th February.I am very stuck on where to start so your help would be apreciated.Regards,Alex Kemsley 解决方案Start with: getDay()--Evertjan.The Netherlands.(Please change the x''es to dots in my emailaddress)var d=new Date();d.setDate(d.getDate()+21-d.getDay());alert(d);Not necessarily formated as you want.-- Start with: getDay()No. Always start with reading the newsgroup FAQ; see below.D = new Date()X = 0D.setDate(D.getDate()+(6+X-D.getDay())%7 +1 +7*N)That changes value as the initial D changes from Sat to Sun.The OP may have an application for which Weeks run Sun..Sat, as in thePrayer Book. But his E-mail address suggests that he is in a country inwhich ISO Weeks, Mon-Sun, are commonly used.He should consider whether the code may be executed on another country,and what should then happen.--(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links. 这篇关于未来的日期计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!