org.activityinfo.model.type.time.LocalDate.getMonthOfYear()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(121)

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

LocalDate.getMonthOfYear介绍

[英]Gets the month-of-year field
[中]获取“月份”字段

代码示例

代码示例来源:origin: bedatadriven/activityinfo

@Override
protected int apply(LocalDate date) {
  return date.getMonthOfYear();
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
protected int apply(LocalDate date) {
  return fromMonth(date.getMonthOfYear());
}

代码示例来源:origin: bedatadriven/activityinfo

@Override
  public PeriodValue containingDate(LocalDate localDate) {
    return new Month(localDate.getYear(), localDate.getMonthOfYear());
  }
}

代码示例来源:origin: bedatadriven/activityinfo

public static int encodeLocalDate(LocalDate value) {
  return value.getYear() << 16 | value.getMonthOfYear() << 8 | value.getDayOfMonth();
}

代码示例来源:origin: bedatadriven/activityinfo

@VisibleForTesting
static double compute(LocalDate startDate, LocalDate endDate) {
  int y1 = startDate.getYear();
  int y2 = endDate.getYear();
  int m1 = startDate.getMonthOfYear();
  int m2 = endDate.getMonthOfYear();
  int d1 = startDate.getDayOfMonth();
  int d2 = endDate.getDayOfMonth();
  // If (Date1 is the last day of February) and (Date2 is the last day of February),
  // then change D2 to 30.
  if(lastDayOfFebruary(m1, d1) && lastDayOfFebruary(m2, d2)) {
    d2 = 30;
  }
  if (lastDayOfFebruary(m1, d1)) {
    d1 = 30;
  }
  if(d2 == 31 && (d1 == 30 || d1 == 31)) {
    d2 = 30;
  }
  if(d1 == 31) {
    d1 = 30;
  }
  return Math.abs((360d * (y2-y1) + 30d * (m2-m1) + (d2-d1)) / 360d);
}

代码示例来源:origin: bedatadriven/activityinfo

private static FormulaNode dateValue(FilterConfig filter) {
  // GXT serializes the date value as unix time value in milliseconds
  long time = Long.parseLong(filter.getValue());
  Date date = new Date(time);
  LocalDate localDate = new LocalDate(date);
  return new FunctionCallNode(DateFunction.INSTANCE,
    new ConstantNode(localDate.getYear()),
    new ConstantNode(localDate.getMonthOfYear()),
    new ConstantNode(localDate.getDayOfMonth()));
}

相关文章