您的任务是输出一个数字。给定日期范围相交的ISO周数。引用Wikipedia:,An average year is exactly 52.1775 weeks long
但这不是平均值。
输入由两个以空格分隔的ISO日期组成:
0047-12-24 2013-06-01
结束日期永远不会早于开始日期。为了简单起见,我们将使用外推的格里高利历。
测试用例:
Format: input -> output
2015-12-31 2016-01-01 -> 1 (both are within week 53 of 2015)
2016-01-03 2016-01-04 -> 2 (the 3rd is within week 53, and the 4th is in week 1)
2015-12-24 2015-12-24 -> 1 (this single day is of course within a single week)
您的解决方案应处理介于0001-01-01
和之间的日期9999-12-31
。
Weeks start with Monday.