Joda-Time剩下几秒钟?

时间:2013-07-01 06:22:44

标签: java jodatime

这让我完全难过,因为我是使用Joda API的新手。如何打印剩余的秒数?

DateTime time1 = DateTime.parse(c.lastBankTime);
DateTime time2 = new DateTime();
Seconds Interval = Seconds.secondsBetween(time1, time2);
Seconds minInterval = Seconds.seconds(10);

if(Interval.isGreaterThan(minInterval)){
    c.sendMessage("been 10 secs");
    c.lastBankTime = new DateTime().toString();
} else{
    c.sendMessage("Please wait n seconds"); //How do I get remaining seconds?
}

1 个答案:

答案 0 :(得分:1)

我不确定你的“剩余秒数”究竟是什么意思,但这是你想要的吗?

 minInterval.minus(Interval).getSeconds()