下面程序使用了两种方法计算两个时间相差 天,小时,分钟,秒
package jodotest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.Hours;
import org.joda.time.Interval;
import org.joda.time.Minutes;
import org.joda.time.Period;
import org.joda.time.Seconds;
/**
* @author wanggang
*
*/
public class Test {
public static void test1(Date d1, Date d2){
// 毫秒ms
long diff = d2.getTime() - d1.getTime();
long diffSeconds = diff / 1000 % 60;
long diffMinutes = diff / (60 * 1000) % 60;
long diffHours = diff / (60 * 60 * 1000) % 24;
long diffDays = diff / (24 * 60 * 60 * 1000);
System.out.print("时间相差:");
System.out.print(diffDays + " 天 ");
System.out.print(diffHours + " 小时 ");
System.out.print(