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

x33g5p2x  于2022-01-17 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(127)

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

DateTime.getDayOfYear介绍

暂无

代码示例

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

DateTime dt = new DateTime();  
int dayOfYear = dt.getDayOfYear();

代码示例来源:origin: prestodb/presto

assertFunction("extract(day FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfMonth());
assertFunction("extract(day_of_month FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfMonth());
assertFunction("extract(day_of_year FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfYear());
assertFunction("extract(year_of_week FROM " + TIMESTAMP_LITERAL + ")", BIGINT, 2001L);
assertFunction("extract(doy FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfYear());
assertFunction("extract(week FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getWeekOfWeekyear());
assertFunction("extract(month FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMonthOfYear());
assertFunction("extract(day FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfMonth());
assertFunction("extract(day_of_month FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfMonth());
assertFunction("extract(day_of_year FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfYear());
assertFunction("extract(doy FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfYear());
assertFunction("extract(week FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getWeekOfWeekyear());
assertFunction("extract(month FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMonthOfYear());

代码示例来源:origin: rackerlabs/blueflood

@Test
public void testDayOfWeekFormat() {
  DateTime todayDate = referenceDateTime();
  for (String dateTimeString: Arrays.asList("Fri", "14:42 Fri", "noon Fri")) {
    DateTime date = DateTimeParser.parse(dateTimeString);
    Assert.assertEquals(date.getDayOfWeek(), 5);
    Assert.assertTrue(todayDate.getDayOfYear() - date.getDayOfYear() <= 7);
  }
}

代码示例来源:origin: apache/phoenix

@Override
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
  Expression arg = getChildren().get(0);
  if (!arg.evaluate(tuple,ptr)) {
    return false;
  }
  if (ptr.getLength() == 0) {
    return true;
  }
  long dateTime = inputCodec.decodeLong(ptr, arg.getSortOrder());
  DateTime jodaDT = new DateTime(dateTime);
  int day = jodaDT.getDayOfYear();
  PDataType returnDataType = getDataType();
  byte[] byteValue = new byte[returnDataType.getByteSize()];
  returnDataType.getCodec().encodeInt(day, byteValue, 0);
  ptr.set(byteValue);
  return true;
}

代码示例来源:origin: org.apache.isis.core/isis-core-applib

/**
 * Day of year (1 to 365 [366 in leap years]) for Gregorian calendar.
 * 
 * @return
 */
public int getDayOfYear() {
  return dateTime.getDayOfYear();
}

代码示例来源:origin: org.apache.isis/applib

/**
 * Day of year (1 to 365 [366 in leap years]) for Gregorian calendar.
 * 
 * @return
 */
public int getDayOfYear() {
  return dateTime.getDayOfYear();
}

代码示例来源:origin: org.modeshape/modeshape-graph

/**
 * {@inheritDoc}
 */
public int getDayOfYear() {
  return this.instance.getDayOfYear();
}

代码示例来源:origin: com.yahoo.maha/maha-par-request-2

public static boolean isSameDate(DateTime date1, DateTime date2) {
  if (date1 != null && date2 != null
    && date1.getDayOfYear() == date2.getDayOfYear()
    && date1.getYear() == date2.getYear()) {
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: com.yahoo.maha/maha-par-request

public static boolean isSameDate(DateTime date1, DateTime date2) {
  if (date1 != null && date2 != null
    && date1.getDayOfYear() == date2.getDayOfYear()
    && date1.getYear() == date2.getYear()) {
    return true;
  } else {
    return false;
  }
}

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

...
DateTime dt = new DateTime(millis);
int day = dt.getDayOfYear();
...

代码示例来源:origin: Baralga/baralga

@Override
public int hashCode() {
  return Objects.hashCode(
    day.getYear(),
    day.getDayOfYear()
  );
}

代码示例来源:origin: com.github.fosin/cdp-utils

/**
 * 年内第多少天?[1-365]
 *
 * @param ts ts
 * @return 结果
 */
public static <T extends Date> int dayOfYear(T ts) {
  checkNotNull(ts);
  return new DateTime(ts.getTime()).getDayOfYear();
}

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

public static void main(String[] args)
{
  DateTime d = new DateTime(2013,12,31,23,59,52,DateTimeZone.UTC);
  System.out.println(d);
  System.out.println(d.getDayOfYear());
}

代码示例来源:origin: Baralga/baralga

@Override
public int hashCode() {
  return Objects.hashCode(
      this.getProject(),
      this.day.getDayOfYear(),
      this.day.getYear()
  );
}

代码示例来源:origin: nl.cloudfarming.client/calendar-api

private boolean rangeInOneDay(DateBounds dateBounds) {
  boolean inOneYear = rangeInOneYear(dateBounds);
  boolean inOneDay = dateBounds.getStart().getDayOfYear() == dateBounds.getEnd().getDayOfYear();
  return inOneYear && inOneDay;
}

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

public static String convertOffsetInYear (DateTime input) {
  int hours = (input.getDayOfYear() - 1) * 24 + input.getHourOfDay();
  return String.format("%d:%02d",hours,input.getMinuteOfHour());
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "yday")
public RubyInteger yday(ThreadContext context) {
  return RubyFixnum.newFixnum(context.runtime, dt.getDayOfYear());
}

代码示例来源:origin: sismics/reader

/**
 * Update the favicon once a week.
 *
 * @param feed The feed
 * @return True if the favicon must be updated
 */
private boolean isFaviconUpdated(Feed feed) {
  boolean newDay = feed.getLastFetchDate() == null ||
      DateTime.now().getDayOfYear() != new DateTime(feed.getLastFetchDate()).getDayOfYear();
  int daysFromCreation = Days.daysBetween(Instant.now(), new Instant(feed.getCreateDate().getTime())).getDays();
  return newDay && daysFromCreation % 7 == 0;
}

代码示例来源:origin: org.netbeans.api/org-jruby

@JRubyMethod(name = "yday")
public RubyInteger yday() {
  return getRuntime().newFixnum(dt.getDayOfYear());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "yday")
public RubyInteger yday() {
  return getRuntime().newFixnum(dt.getDayOfYear());
}

相关文章

DateTime类方法