本文整理汇总了Java中org.joda.time.DateTime.minusMinutes方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.minusMinutes方法的具体用法?Java DateTime.minusMinutes怎么用?Java DateTime.minusMinutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateTime
的用法示例。
在下文中一共展示了DateTime.minusMinutes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSession
import org.joda.time.DateTime; //导入方法依赖的package包/类
@ActionMethod
public Result checkSession() {
Session session = getSession();
if (session == null || session.getSince() == null) {
Logger.info("Session not found");
return ok("no_session");
}
DateTime expirationTime = session.getSince().plusMinutes(SITNET_TIMEOUT_MINUTES);
DateTime alarmTime = expirationTime.minusMinutes(2);
Logger.debug("Session expiration due at {}", expirationTime);
if (expirationTime.isBeforeNow()) {
Logger.info("Session has expired");
return ok("no_session");
} else if (alarmTime.isBeforeNow()) {
return ok("alarm");
}
return ok();
}
示例2: requestContentOfIncrement
import org.joda.time.DateTime; //导入方法依赖的package包/类
private String requestContentOfIncrement(Market market) {
JSONObject json = new JSONObject();
final String action = "android.getincrement";
json.put("action", action);
json.put("sc", market.getSecurity());
json.put("pno", market.getIncrementLastReqCurrentPage() + 1);
json.put("psize", market.getPageSize());
StringBuilder chkCode = new StringBuilder(action).append(market.getSecurity()).append(market.getLoginKey());
String chkcode = DigestUtils.md5Hex(chkCode.toString());
json.put("chkcode", chkcode);
json.put("islastest", 1);
Date fetch = market.getIncrementLastTime();
fetch = fetch == null ? new Date() : fetch;
// special logical.
DateTime jodaDt = new DateTime(fetch);
jodaDt = jodaDt.minusMinutes(60);
json.put("timestamp", jodaDt.getMillis() / 1000);
return json.toJSONString();
}
示例3: getMarketAppForIncrement
import org.joda.time.DateTime; //导入方法依赖的package包/类
@Override
public PaginationMarketApp getMarketAppForIncrement(Market market) throws Exception {
String url = market.getIncrementUrl();
Assert.isTrue(!url.isEmpty());
Date lastTimeInDb = market.getIncrementLastTime();
lastTimeInDb = lastTimeInDb == null ? new Date() : lastTimeInDb;
long lastTime = 0L;
if (lastTimeInDb != null) {
lastTime = lastTimeInDb.getTime();
}
DateTime jodaDt = new DateTime(lastTime);
jodaDt = jodaDt.minusMinutes(60);
int currentPage = market.getIncrementLastReqCurrentPage() + 1;
int pageSize = market.getPageSize();
PaginationMarketApp increment = this.getIncrementMarketApp(url, currentPage, jodaDt.getMillis(),
market.getLoginKey(), pageSize, market.getSecurity());
return increment;
}
示例4: getBegin
import org.joda.time.DateTime; //导入方法依赖的package包/类
/**
* 根据时间戳获取开始时间
* @param timestamp
* @param window
* @return
*/
private String getBegin(long timestamp, int window) {
DateTime end = new DateTime(timestamp).minusSeconds(this.delay);
DateTime begin = end.minusMinutes(window);
return begin.toString(DateUtil.YYYYMMDDHHMMSS);
}