java.time.ZonedDateTime.getDayOfYear()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(207)

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

ZonedDateTime.getDayOfYear介绍

[英]Gets the day-of-year field.

This method returns the primitive int value for the day-of-year.
[中]获取“年度日期”字段。
此方法返回一年中某一天的原始int值。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

public int getDayOfYear() {
  return dt.getDayOfYear();
}

代码示例来源:origin: espertechinc/esper

public Object evaluateInternal(ZonedDateTime ldt) {
  return ldt.getDayOfYear();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

public int getDayOfYear() {
  return dt.getDayOfYear();
}

代码示例来源:origin: apache/servicemix-bundles

public int getDayOfYear() {
  return dt.getDayOfYear();
}

代码示例来源:origin: io.atlasmap/atlas-core

@AtlasFieldActionInfo(name = "DayOfYear", sourceType = FieldType.ANY_DATE, targetType = FieldType.INTEGER, sourceCollectionType = CollectionType.NONE, targetCollectionType = CollectionType.NONE)
  public static Integer dayOfYear(Action action, ZonedDateTime input) {
    return input == null ? null : input.getDayOfYear();
  }
}

代码示例来源:origin: co.cask.wrangler/wrangler-core

/**
 * Extracts Day of the year from the date.
 *
 * @param date to extract date of the year.
 * @return date of the year.
 */
public static int DAY_OF_YEAR(ZonedDateTime date) {
 validate(date, "DAY_OF_YEAR");
 return date.getDayOfYear();
}

代码示例来源:origin: com.daioware/dateUtilities

public static int getDayOfYear() {
  return getCurrentZonedDateTime().getDayOfYear();
}
public static int getDayOfYear(ZoneId zoneId) {

代码示例来源:origin: com.squarespace.cldr/cldr-runtime

/**
 * Format the 3-digit day of the year, zero padded.
 */
void formatDayOfYear(StringBuilder b, ZonedDateTime d, int width) {
 int day = d.getDayOfYear();
 int digits = day < 10 ? 1 : day < 100 ? 2 : 3;
 switch (digits) {
  case 1:
   if (width > 1) {
    b.append('0');
   }
   // fall through
  case 2:
   if (width > 2) {
    b.append('0');
   }
   // fall through
  case 3:
   b.append(day);
   break;
 }
}

代码示例来源:origin: com.daioware/dateUtilities

public static int getDayOfYear(ZoneId zoneId) {
  return getCurrentZonedDateTime(zoneId).getDayOfYear();
}
public static int getHour(){

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

ZoneId zoneId = ZoneId.of( "America/Montreal" );
ZonedDateTime now = ZonedDateTime.now( zoneId );
int dayOfMonth = now.getDayOfMonth();
int dayOfWeek = now.getDayOfWeek().getValue();
int dayOfYear = now.getDayOfYear();

代码示例来源:origin: com.github.javaito/hcjf

case GET_DAY_OF_MONTH: result = getZonedDateTimeFromDate(parameters).getDayOfMonth(); break;
case GET_DAY_OF_WEEK: result = getZonedDateTimeFromDate(parameters).getDayOfWeek(); break;
case GET_DAY_OF_YEAR: result = getZonedDateTimeFromDate(parameters).getDayOfYear(); break;
case GET_HOUR: result = getZonedDateTimeFromDate(parameters).getHour(); break;
case GET_MINUTE: result = getZonedDateTimeFromDate(parameters).getMinute(); break;

代码示例来源:origin: UniversaBlockchain/universa

public void parcelAssertions(Parcel equal1, Parcel equal2 ) throws Exception {
  //few assertions
  assertEquals(equal1.getPayload().getContract().getId(), equal2.getPayload().getContract().getId());
  assertEquals(equal1.getPayment().getContract().getId(), equal2.getPayment().getContract().getId());
  assertEquals(equal1.getPayload().getContract().getState().getBranchId(), equal2.getPayload().getContract().getState().getBranchId());
  assertEquals(equal1.getPayment().getContract().getState().getBranchId(), equal2.getPayment().getContract().getState().getBranchId());
  assertEquals(equal1.getPayload().getContract().getState().getCreatedAt().getSecond(), equal2.getPayload().getContract().getState().getCreatedAt().getSecond());
  assertEquals(equal1.getPayment().getContract().getState().getCreatedAt().getSecond(), equal2.getPayment().getContract().getState().getCreatedAt().getSecond());
  assertEquals(equal1.getPayload().getContract().getExpiresAt().getDayOfYear(), equal2.getPayload().getContract().getExpiresAt().getDayOfYear());
  assertEquals(equal1.getPayment().getContract().getExpiresAt().getDayOfYear(), equal2.getPayment().getContract().getExpiresAt().getDayOfYear());
  assertEquals(equal1.getPayload().getSubItems().size(), equal2.getPayload().getSubItems().size());
  assertEquals(equal1.getPayment().getSubItems(), equal2.getPayment().getSubItems());
}

代码示例来源:origin: AnalyticalGraphicsInc/czml-writer

@Test
public final void testYearDayConstructor() {
  ZonedDateTime aTime = DateTimeHelper.create(2000, 2, 28, 1, 3, 4);
  Assert.assertEquals((int) 31 + 28, (int) aTime.getDayOfYear());
  //* January has 31 days, so add 28 to that...
  GregorianDate sameDate = new GregorianDate(aTime.getYear(), aTime.getDayOfYear());
  Assert.assertEquals((int) 2000, (int) sameDate.getYear());
  Assert.assertEquals((int) 59, (int) sameDate.getDayOfYear());
  Assert.assertEquals((int) 2, (int) sameDate.getMonth());
  Assert.assertEquals((int) 0, (int) sameDate.getHour());
  Assert.assertEquals((int) 0, (int) sameDate.getMinute());
  Assert.assertEquals(0, sameDate.getSecond(), 0d);
  sameDate = new GregorianDate(2000, 60.6);
  //* 60 days and 14.4 hours, or 14 hours and 24 minutes (1/10 of a day is 2.4 hours, times that by 6)
  Assert.assertEquals((int) 2000, (int) sameDate.getYear());
  Assert.assertEquals((int) 60, (int) sameDate.getDayOfYear());
  Assert.assertEquals((int) 2, (int) sameDate.getMonth());
  //* leap year
  Assert.assertEquals((int) 14, (int) sameDate.getHour());
  Assert.assertEquals((int) 24, (int) sameDate.getMinute());
  Assert.assertEquals(0D, sameDate.getSecond(), Constants.Epsilon9);
  //* Richard and Michael both said this is ok
}

相关文章

ZonedDateTime类方法