一个月的第一个/最后一个星期是什么? [英] What is the first/last week of a month?

查看:155
本文介绍了一个月的第一个/最后一个星期是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人在某个月的第一个或最后一个星期发生一些事情,那么你如何定义这个跨度?

If someone were to say something happens in the first or last week of some month, how would you define that span?

我正在开发一个需要以直观的方式处理这种事情的图书馆,但是我的直觉并不是要求一个案例

I'm working on a library that needs to handle this kind of thing in an intuitive way, but my intuition doesn't claim one case or the other.

我可以选择不同的行为,但仍需要很好的默认值。

I can make it select different behavior but still need a good default.

对于一个具体的例子,我将选择一个随机的月份:2008年7月

For a concrete example I'll just to pick an random month: July 2008

s  m  t  w  r  f  s
--------------------
      1  2  3  4  5
6  7  8  9  10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

(注意:我会假设星期几从星期天开始,但问题可能会在星期一被问到)

这个月的第一个星期?


  1. 6月29日 - 7月5日 - 包含fi第一个

  2. 7月6日 - 12日 - 这个月的第一周

  1. June 29 - July 5 -- the week that includes the first
  2. July 6 - 12 -- the first week that is all the way into the month


    第二周只是第一个右边的7天?

The second week is just the 7 days following the first right?

这个月的最后一个星期是什么?

What span is the last week of the month?


  1. 7月27日 - 8月2日 - 同上,但最后一天

  2. 7月20日 - 26日 - 同上,但上周

  1. July 27 - Aug 2 -- ditto but the last day
  2. July 20 - 26 -- ditto but the last week

欢迎

推荐答案

没有答案,因为它甚至在一个国家也不一样。

然而,这个来源似乎认为它被ISO标准定义为包含星期四的第一周。但是,上述消息来源称,ISO标准没有列出本月第一周的规范。

However, this source seems to think it's defined by the ISO standard as the first week that contains a thursday. However the above source says that the ISO standard does not list a specification for 'first week of the month'

>超过300个字符 - 对不起!

More than 300 chars - sorry!

ISO 8601标准将YEAR的第一周定义为:

The ISO 8601 standard defines the first week of the YEAR as:


日历周号

calendar week number

根据第一个$ b的规则,在其日历年内标识一个日历周的序数一年的$ b日历周是包括那一年的第一个星期四,一个日历年的最后一个日历
周是紧接在下一个日历年的第一个日历周之前的一周。

ordinal number which identifies a calendar week within its calendar year according to the rule that the first calendar week of a year is that one which includes the first Thursday of that year and that the last calendar week of a calendar year is the week immediately preceding the first calendar week of the next calendar year

ISO 8601中关于本月第一周没有任何内容,因为如上所述,定义因国家(甚至公司,例如)。哦,标准是星期一星期开始。

There is nothing in ISO 8601 about the first week of the month because, as has been noted, the definition varies by country (and even by company, for example). Oh, and the standard says that weeks start on Monday.

这篇关于一个月的第一个/最后一个星期是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆