javascript倒数计时器,有几个星期和几个月

时间:2021-12-29 21:27:52

I need a countdown script to calculate the difference between two dates, in months, weeks, and days.
I know about timespan.js and countdown.js, but those scripts only work with days.
What script could I use for months and weeks?
preferable the dates are in the yyyy-mm-dd format

我需要一个倒计时脚本来计算两个日期之间的差异,以月,周和日为单位。我知道timespan.js和countdown.js,但这些脚本只能使用几天。我可以使用几个月和几周的脚本?最好是日期是yyyy-mm-dd格式

2 个解决方案

#1


How about moment.js? There is probably a 'months' feature? https://www.google.com/search?client=safari&rls=en&q=moment.js+difference+between+two+dates+in+months&ie=UTF-8&oe=UTF-8

moment.js怎么样?可能有'几个月'功能? https://www.google.com/search?client=safari&rls=en&q=moment.js+difference+between+two+dates+in+months&ie=UTF-8&oe=UTF-8

#2


Check the console

检查控制台

http://jsfiddle.net/x9yL7xL7/

moment('2018-02-01 00:00:00');

Taken from: http://www.netengine.at/de/hilfe/wiki/wiki-detail/?wid=90

摘自:http://www.netengine.at/de/hilfe/wiki/wiki-detail/?wid = 90

#1


How about moment.js? There is probably a 'months' feature? https://www.google.com/search?client=safari&rls=en&q=moment.js+difference+between+two+dates+in+months&ie=UTF-8&oe=UTF-8

moment.js怎么样?可能有'几个月'功能? https://www.google.com/search?client=safari&rls=en&q=moment.js+difference+between+two+dates+in+months&ie=UTF-8&oe=UTF-8

#2


Check the console

检查控制台

http://jsfiddle.net/x9yL7xL7/

moment('2018-02-01 00:00:00');

Taken from: http://www.netengine.at/de/hilfe/wiki/wiki-detail/?wid=90

摘自:http://www.netengine.at/de/hilfe/wiki/wiki-detail/?wid = 90