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

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

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

DateTime.getDayOfWeek介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-gobblin

if (!Iterables.any(days, new AreDaysEqual(DAYS_OF_WEEK.get(currentTime.getDayOfWeek())))) {
 return false;

代码示例来源:origin: GitLqr/LQRWeChat

} else if (days <= 7) {
  switch (msgTime.getDayOfWeek()) {
    case DateTimeConstants.SUNDAY:
      return "周日 " + getTime(msgTime);

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

assertFunction("extract(minute FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getMinuteOfHour());
assertFunction("extract(hour FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getHourOfDay());
assertFunction("extract(day_of_week FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfWeek());
assertFunction("extract(dow FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfWeek());
assertFunction("extract(day FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfMonth());
assertFunction("extract(day_of_month FROM " + TIMESTAMP_LITERAL + ")", BIGINT, (long) TIMESTAMP.getDayOfMonth());
assertFunction("extract(minute FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getMinuteOfHour());
assertFunction("extract(hour FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getHourOfDay());
assertFunction("extract(day_of_week FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfWeek());
assertFunction("extract(dow FROM " + WEIRD_TIMESTAMP_LITERAL + ")", BIGINT, (long) WEIRD_TIMESTAMP.getDayOfWeek());
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());

代码示例来源:origin: xiaojianglaile/Calendar

private void initStartDate() {
  mStartDate = new DateTime();
  mStartDate = mStartDate.plusDays(-mStartDate.getDayOfWeek() % 7);
}

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

date = tryParseDateTime(dayOfWeekFormat, stringToParse);
if (date != null)
  while (resultDateTime.getDayOfWeek() != date.getDayOfWeek())
    resultDateTime = resultDateTime.minusDays(1);
return resultDateTime;

代码示例来源: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.getDayOfWeek();
  PDataType returnDataType = getDataType();
  byte[] byteValue = new byte[returnDataType.getByteSize()];
  returnDataType.getCodec().encodeInt(day, byteValue, 0);
  ptr.set(byteValue);
  return true;
}

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

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

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

DateTimeZone timeZone = DateTimeZone.forID( "America/Montreal" );
DateTime start = DateTime.now(  timeZone );
// DateTime start = new DateTime( fileLastModifiedMillis, timeZone );
DateTime dateTime = start; 
while ( dateTime.getDayOfWeek() != DateTimeConstants.FRIDAY ) {
  dateTime = dateTime.plusDays( 1 );
}

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

String date = cursor.getString(cursor.getColumnIndex("date"));
Long timestamp = Long.parseLong(date);
DateTime dateTime = new DateTime(timestamp);
int dayOfWeek = dateTime.getDayOfWeek();
int monthOfYear = dateTime1.getMonthOfYear();

代码示例来源:origin: eryk/JQuant

private DateTime addDays(DateTime dateTime, int days) {
  DateTime dt = dateTime;
  for (int i = 0; i < days; i++) {
    dt = dt.plusDays(-1);
    if (dt.getDayOfWeek() == 7) {
      dt = dt.plusDays(-2);
    }
  }
  return dt;
}

代码示例来源:origin: dhis2/dhis2-core

/**
 * Converts from Joda-Time DateTime to DateUnit
 *
 * @param dateTime DateTime object
 * @return Populated DateUnit object
 */
public static DateTimeUnit fromJodaDateTime( DateTime dateTime )
{
  return new DateTimeUnit( dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), dateTime.getDayOfWeek() );
}

代码示例来源:origin: sulo61/HorizontalExpandableCalendar-Android

private static DateTime getEndDate() {
 DateTime END_FORWARD_BY_RANGE = INIT_DATE.plusMonths(RANGE_MONTHS_AFTER_INIT + 1);
 DateTime END_BACK_TO_FIRST_DAY_OF_MONTH = END_FORWARD_BY_RANGE.plusDays(-END_FORWARD_BY_RANGE.getDayOfMonth() + 1);
 return END_BACK_TO_FIRST_DAY_OF_MONTH.plusDays(7 - END_BACK_TO_FIRST_DAY_OF_MONTH.getDayOfWeek() + 1);
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nullable
public Boolean getIsWeekend()
{
  return WEEKEND.contains(new DateTime(new Date(), DateTimeZone.forTimeZone(getUserTimeZone())).getDayOfWeek()) ? Boolean.TRUE : null;
}

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

@JRubyMethod
public RubyInteger wday(ThreadContext context) {
  // Sunday is day-of-week 0; Saturday is day-of-week 6.
  return RubyFixnum.newFixnum(context.runtime, dt.getDayOfWeek() % 7);
}

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

DateTimeFormatter dateParser = DateTimeFormat.forPattern("yyyy-MM-dd");        
DateTime date = dateParser.parseDateTime("2001-03-10");                        
DateTime initDate = date;                                                      
date = date.withDayOfMonth(13); //reset to the 13 of the current month          
if (date.compareTo(initDate) == -1) //add a month if the start date was after 13 
  date=date.plusMonths(1);                                                   
while (date.getYear() == initDate.getYear()) {                                 
  date = date.plusMonths(1);                                                 
  if (date.getDayOfWeek() == DateTimeConstants.FRIDAY)                       
    System.out.println("date = " + date);                                  
}

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

@JRubyMethod
public RubyInteger cwday(ThreadContext context) {
  // Monday is commercial day-of-week 1; Sunday is commercial day-of-week 7.
  return RubyFixnum.newFixnum(context.runtime, dt.getDayOfWeek());
}

代码示例来源:origin: FenixEdu/fenixedu-academic

private static String key(final LessonInstance instance) {
  final StringBuilder key = new StringBuilder();
  key.append(instance.getBeginDateTime().getDayOfWeek());
  key.append('_');
  key.append(instance.getStartTime().toString("HH:mm"));
  key.append('_');
  key.append(instance.getEndTime().toString("HH:mm"));
  key.append('_');
  key.append(instance.getRoom() == null ? "" : instance.getRoom().getExternalId());
  return key.toString();
}

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

// Specify a time zone rather than rely on default.
DateTimeZone timeZone = DateTimeZone.forID( "Europe/Paris" );

int year = 2014;
int month = 1; // Sensible one-based counting. January = 1, February = 2, …
int dayOfMonth = 2;

DateTime dateTime = new DateTime( year, month, dayOfMonth, 0, 0, 0, timeZone );

// Day-of-week info.
int dayOfWeekNumber = dateTime.getDayOfWeek(); // Standard week (ISO 8601). Monday = 1, Sunday = 7.
DateTime.Property dayOfWeekProperty = dateTime.dayOfWeek();
String dayOfWeekName_Short = dayOfWeekProperty.getAsShortText( Locale.FRANCE );
String dayOfWeekName_Long = dayOfWeekProperty.getAsText( Locale.FRANCE );

代码示例来源:origin: com.mysema.rdf/rdfbean-core

@Test
public void DayOfWeek() {
  int dow = dateTime.getDayOfWeek();
  assertEquals(dow == 7 ? 1 : dow + 1, QueryFunctions.dayOfWeek(dateTimeString));
}

相关文章

DateTime类方法