zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package PbuliClass;
import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
 
public class Shi_jian_cha {
    static String alltime;
 
    static public String getAllTime(String intime,String outtime) {
        SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date begin = null;
        Date end = null;
        try {
            begin = dfs.parse(intime);
            end = dfs.parse(outtime);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        
        long l=end.getTime()-begin.getTime();
        long day=l/(24*60*60*1000);
        long hour=(l/(60*60*1000)-day*24);
        long min=((l/(60*1000))-day*24*60-hour*60);
        long s=(l/1000-day*24*60*60-hour*60*60-min*60);
        if(day==0 && hour==0 && min==0) {
            alltime=s+"Ãë";
        }else if(day==0 && hour==0 ) {
            alltime=min+"·Ö"+s+"Ãë";
        }else if(day==0) {
            alltime=hour+"Сʱ"+min+"·Ö"+s+"Ãë";
        }else {
            alltime=""+day+"Ìì"+hour+"Сʱ"+min+"·Ö"+s+"Ãë";
        }
        
        return alltime;
    }
 
 
 
}