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

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

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

LocalDate.getWeekOfWeekyear介绍

[英]Get the week of weekyear field value.

This field is associated with the "weekyear" via #getWeekyear(). 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.
[中]获取weekyear字段值的周数。
此字段通过#getWeekyear()与“weekyear”关联。在标准ISO8601周算法中,一年中的第一周是一年中至少有4天的一周。根据该定义,第一周的第1天可能是前一年。

代码示例

代码示例来源:origin: com.synaptix/SynaptixWidget

private boolean compareWeekDateByIndex(final int referenceDateIndex, final int comparedDateIndex) {
  final LocalDate date = super.parent.getColumnDefinitionAt(referenceDateIndex);
  final LocalDate nextDate = super.parent.getColumnDefinitionAt(comparedDateIndex);
  return date.getWeekOfWeekyear() == nextDate.getWeekOfWeekyear();
}

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

public int getWeek() {
  if (timeUnit != TimeUnit.WEEK)
    throw new IllegalStateException("Unexpected check for week 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).getWeekOfWeekyear();
}

代码示例来源: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: com.synaptix/SynaptixWidget

private void paintLeftBorderIfEndOfWeek(final int columnIndex, final Graphics2D graphics, final Rectangle rectangleToPaint) {
    if (columnIndex + 1 < super.parent.getColumnDefinitionList().size()) {
      final LocalDate date = super.parent.getColumnDefinitionAt(columnIndex);
      final LocalDate nextDate = super.parent.getColumnDefinitionAt(columnIndex + 1);
      if (date.getWeekOfWeekyear() != nextDate.getWeekOfWeekyear()) {
        graphics.setColor(this.colorScheme.getDarkColor().darker());
        graphics.fillRect(rectangleToPaint.x + rectangleToPaint.width - 1, rectangleToPaint.y, 1, rectangleToPaint.height);

      }
    }
  }
}

代码示例来源:origin: com.synaptix/SynaptixWidget

private void paintLeftBorderIfEndOfWeek(final int columnIndex, final Graphics2D graphics, final Rectangle rectangleToPaint) {
    if (columnIndex + 1 < super.parent.getColumnDefinitionList().size()) {
      final LocalDate date = super.parent.getColumnDefinitionAt(columnIndex);
      final LocalDate nextDate = super.parent.getColumnDefinitionAt(columnIndex + 1);
      if (date.getWeekOfWeekyear() != nextDate.getWeekOfWeekyear()) {
        graphics.setColor(this.colorScheme.getDarkColor().darker());
        graphics.fillRect(rectangleToPaint.x + rectangleToPaint.width - 1, rectangleToPaint.y, 1, rectangleToPaint.height);

      }
    }
  }
}

代码示例来源:origin: com.synaptix/SynaptixWidget

@Override
  public CellInformation getCellInformation(int rowIndex, int columnIndex) {
    final LocalDate date = super.parent.getColumnDefinitionAt(columnIndex);
    Object obj = null;
    if (rowIndex == 0) {
      obj = date.toString(StaticWidgetHelper.getSynaptixDateConstantsBundle().hierarchicalMonthDisplay());
    } else if (rowIndex == 1) {
      obj = StaticWidgetHelper.getSynaptixDateConstantsBundle().week(date.getWeekOfWeekyear());
    } else if (rowIndex == 2) {
      obj = StaticWidgetHelper.getSynaptixDateConstantsBundle().shortWeekDays().get(String.valueOf(date.getDayOfWeek())) + String.valueOf(date.getDayOfMonth());
    }
    return new CellInformation(obj);
  }
}

代码示例来源:origin: com.synaptix/SynaptixWidget

GraphicsHelper.paintCenterString(graphics, StaticWidgetHelper.getSynaptixDateConstantsBundle().week(date.getWeekOfWeekyear()), graphics.getFont(), rectangleToPaint.x, rectangleToPaint.y,
    rectangleToPaint.width, rectangleToPaint.height);

相关文章