代码之家  ›  专栏  ›  技术社区  ›  otto.poellath

Joda时间:今年ISO第1周的第一天

  •  12
  • otto.poellath  · 技术社区  · 15 年前

    我想知道今年ISO第1周的星期一的日期(2009年是2008年12月29日,星期一)。

    我相信 joda-time

    2 回复  |  直到 11 年前
        1
  •  25
  •   nbrooks    9 年前

    这个 DateMidnight 另一个答案中提到的API现已弃用,请使用以下方法:

    DateTime date = new DateTime().dayOfYear().withMinimumValue().withTimeAtStartOfDay();
    
        2
  •  12
  •   Colin Hebert    13 年前

    我认为这应该是可行的:

    DateMidnight date = new DateMidnight().withWeekOfWeekyear(1).withDayOfWeek(1);