当前位置: 首页>>代码示例>>Java>>正文


Java DateTime.minusSeconds方法代码示例

本文整理汇总了Java中org.joda.time.DateTime.minusSeconds方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.minusSeconds方法的具体用法?Java DateTime.minusSeconds怎么用?Java DateTime.minusSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.DateTime的用法示例。


在下文中一共展示了DateTime.minusSeconds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ICalendarMeeting

import org.joda.time.DateTime; //导入方法依赖的package包/类
public ICalendarMeeting(MeetingInterface meeting, Status status) {
	if (meeting.getStartTime() != null) {
		iStart = new DateTime(meeting.getStartTime());
	} else {
		iStart = new DateTime(meeting.getMeetingDate()).plusMinutes((5 * meeting.getStartSlot()) + meeting.getStartOffset());
	}
	if (meeting.getStartTime() != null) {
		iEnd = new DateTime(meeting.getStopTime());
	} else {
		iEnd = new DateTime(meeting.getMeetingDate()).plusMinutes((5 * meeting.getEndSlot()) + meeting.getEndOffset());
	}
	if (iStart.getSecondOfMinute() != 0) iStart = iStart.minusSeconds(iStart.getSecondOfMinute());
	if (iEnd.getSecondOfMinute() != 0) iEnd = iEnd.minusSeconds(iEnd.getSecondOfMinute());
	if (iStart.getMillisOfSecond() != 0) iStart = iStart.minusMillis(iStart.getMillisOfSecond());
	if (iEnd.getMillisOfSecond() != 0) iEnd = iEnd.minusMillis(iEnd.getMillisOfSecond());
	iLocation = meeting.getLocationName(MESSAGES);
	iStatus = (status != null ? status : meeting.isApproved() ? Status.confirmed() : Status.tentative());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:EventsExportEventsToICal.java

示例2: testArrival

import org.joda.time.DateTime; //导入方法依赖的package包/类
@Test
public void testArrival() {

    DateTime t1 = new DateTime(2016, 5, 24, 11, 0, DateTimeZone.UTC);

    RouteLegList routeLegList = new RouteLegList(t1, true);

    WalkingLeg walkingLeg1 = new WalkingLeg(LegType.WalkingLeg, geoCoord, geoCoord, distance, 50, sr, "");
    DateTime t2 = t1.minusSeconds(50);

    routeLegList.addAndShift(new RouteLegWrapper(walkingLeg1));
    System.out.println(routeLegList);

    CarLeg carLeg = new CarLeg(LegType.CarLeg, geoCoord, geoCoord, distance, 280, sr, "");
    DateTime t3 = t2.minusSeconds(280);

    Interval interval = routeLegList.getIntervalAfterPossibleLeg(carLeg.getDuration());
    System.out.println(interval);

    Assert.assertEquals(interval, new Interval(t3, t2));
    routeLegList.addAndShift(new RouteLegWrapper(carLeg));
    System.out.println(routeLegList);

    WalkingLeg walkingLeg2 = new WalkingLeg(LegType.WalkingLeg, geoCoord, geoCoord, distance, 90, sr, "");
    DateTime t4 = t3.minusSeconds(90);

    Interval interval2 = routeLegList.getIntervalAfterPossibleLeg(walkingLeg2.getDuration());
    System.out.println(interval2);

    Assert.assertEquals(interval2, new Interval(t4, t3));

    routeLegList.addAndShift(new RouteLegWrapper(walkingLeg2));
    System.out.println(routeLegList);
}
 
开发者ID:RWTH-i5-IDSG,项目名称:xsharing-services-router,代码行数:35,代码来源:RouteLegListTest.java


注:本文中的org.joda.time.DateTime.minusSeconds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。