org.joda.time.LocalDate.getWeekyear()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.joda.time.LocalDate.getWeekyear()方法的一些代码示例,展示了LocalDate.getWeekyear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.getWeekyear()方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:getWeekyear

LocalDate.getWeekyear介绍

[英]Get the weekyear field value.

The weekyear is the year that matches with the weekOfWeekyear field. In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year. The weekyear allows you to query the effective year for that day.
[中]获取weekyear字段值。
weekyear是与weekOfWeekyear字段匹配的年份。在标准ISO8601周算法中,一年中的第一周是一年中至少有4天的一周。根据该定义,第一周的第1天可能是前一年。weekyear允许您查询该天的有效年份。

代码示例

代码示例来源:origin: stackoverflow.com

import org.joda.time.*;

public class Test {
  public static void main(String[] args) throws Exception {
    LocalDate date = new LocalDate(2016, 1, 1);
    System.out.println(date);
    System.out.println(date.getWeekOfWeekyear());
    System.out.println(date.getWeekyear());
  }    
}

代码示例来源:origin: fluxtream/fluxtream-app

public int getWeekYear() {
  if (timeUnit != TimeUnit.WEEK)
    throw new IllegalStateException("Unexpected check for week year when not using week time unit");
  // Off by 1 because getBeginningOfWeek(year, week), and by extension
  // setWeek(year, week) goes back by 1 week
  return fromDate.plusWeeks(1).getWeekyear();
}

相关文章