我使用 JodaTime 库进行时间操作。我有两个日期: 日期一:
DateTime time_server = new DateTime(server_time_milisecs).
withZone(DateTimeZone.forID("Europe/Zurich")); //+0100
显示:2013-01-27 13:44:42
日期二:
DateTime time_local = new DateTime(DateTime.now()).
withZone(DateTimeZone.getDefault()); //Have "Europe/Moscow" timezone +0400
显示:2013-01-27 16:41:47
我需要找到包括时区在内的真实间隔
Interval interval = new Interval(time_local, time_server);
Long.toString(interval.toDurationMillis()));
结果:174040 毫秒 -不正确
int secs = Seconds.secondsBetween(time_local,time_server).getSeconds();
结果:174 秒不正确
Period period = new Period(time_local, time_server);
Integer.toString(period.getSeconds()) //**Wrong too**
结果必须是:10974 秒