package com.platform.modules.live.utils;

import java.util.Date;

public class CalculateTimeDifference {
	
	/**
	 * 计算天数差
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public static int CalculateDaysDifference(Date startDate,Date endDate){
		if(startDate==null || endDate==null){
			return 0;
		}
	    long startTime = startDate.getTime();  
	    long endTime = endDate.getTime();  
	    int days = (int) ((endTime - startTime) / (1000 * 60 * 60 * 24)); 
	    return days;
	}
	/**
	 * 计算小时差
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public static int CalculateHoursDifference(Date startDate,Date endDate){
		if(startDate==null || endDate==null){
			return 0;
		}
	    long startTime = startDate.getTime();  
	    long endTime = endDate.getTime();  
	    int days = (int) ((endTime - startTime) / (1000 * 60 * 60)); 
	    return days;
	}


}
