当前位置: 首页>>代码示例>>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;未经允许,请勿转载。