當前位置: 首頁>>代碼示例>>Java>>正文


Java DateTime.isEqual方法代碼示例

本文整理匯總了Java中org.joda.time.DateTime.isEqual方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.isEqual方法的具體用法?Java DateTime.isEqual怎麽用?Java DateTime.isEqual使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.DateTime的用法示例。


在下文中一共展示了DateTime.isEqual方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: equivalentTo

import org.joda.time.DateTime; //導入方法依賴的package包/類
public static Matcher<String> equivalentTo(DateTime expected) {
  return new TypeSafeMatcher<String>() {
    @Override
    public void describeTo(Description description) {
      description.appendText(String.format(
        "a date time matching: %s", expected.toString()));
    }

    @Override
    protected boolean matchesSafely(String textRepresentation) {
      //response representation might vary from request representation
      DateTime actual = DateTime.parse(textRepresentation);

      return expected.isEqual(actual);
    }
  };
}
 
開發者ID:folio-org,項目名稱:mod-circulation-storage,代碼行數:18,代碼來源:TextDateTimeMatcher.java

示例2: isEqual

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Override
public boolean isEqual(Event record1, Event record2, Attribute attribute) {
    if(record1.getDates().size()==0 && record2.getDates().size()==0)
        return true;
    else if(record1.getDates().size()==0 ^ record2.getDates().size()==0)
        return false;
    else {//compare all dates
        for (DateTime r1Date : record1.getDates()) {
            for (DateTime r2Date : record2.getDates()) {
                if (r1Date.isEqual(r2Date)) {
                    return true;//record1.getDates().getYear() == record2.getDates().getYear();
                }
            }
        }
        return false;
    }
}
 
開發者ID:olehmberg,項目名稱:winter,代碼行數:18,代碼來源:EventDateEvaluationRule.java

示例3: dateBetweenSearch

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Test
public void dateBetweenSearch() throws IOException, SqlParseException, SQLFeatureNotSupportedException {
	DateTimeFormatter formatter = DateTimeFormat.forPattern(DATE_FORMAT);

	DateTime dateLimit1 = new DateTime(2014, 8, 18, 0, 0, 0);
	DateTime dateLimit2 = new DateTime(2014, 8, 21, 0, 0, 0);

	SearchHits response = query(String.format("SELECT insert_time FROM %s/online WHERE insert_time BETWEEN '2014-08-18' AND '2014-08-21' LIMIT 3", TEST_INDEX));
	SearchHit[] hits = response.getHits();
	for(SearchHit hit : hits) {
		Map<String, Object> source = hit.getSource();
		DateTime insertTime = formatter.parseDateTime((String) source.get("insert_time"));

		boolean isBetween =
				(insertTime.isAfter(dateLimit1) || insertTime.isEqual(dateLimit1)) &&
				(insertTime.isBefore(dateLimit2) || insertTime.isEqual(dateLimit2));

		Assert.assertTrue("insert_time must be between 2014-08-18 and 2014-08-21", isBetween);
	}
}
 
開發者ID:mazhou,項目名稱:es-sql,代碼行數:21,代碼來源:QueryTest.java

示例4: hasExpired

import org.joda.time.DateTime; //導入方法依賴的package包/類
private boolean hasExpired(DateTime partitionDateTime, DateTime expiryThreshold) {
    return partitionDateTime.isEqual(expiryThreshold) || partitionDateTime.isBefore(expiryThreshold);
}
 
開發者ID:awslabs,項目名稱:serverless-cf-analysis,代碼行數:4,代碼來源:RemoveAthenaPartitions.java


注:本文中的org.joda.time.DateTime.isEqual方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。