-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.java
More file actions
36 lines (30 loc) · 1.04 KB
/
Copy pathTime.java
File metadata and controls
36 lines (30 loc) · 1.04 KB
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
public class Time {
private int hour;
private int minute;
private int second;
public Time() {
}
public Time(int hour, int minute, int second) {
this.hour = hour;
this.minute = minute;
this.second = second;
}
public long getSecondsBetweenTwoDay(Date from, Date to) {
int days = new Date().countDaysBetweenTwoDate(
from.getYear(), from.getMonth(), from.getDay(), to.getYear(), to.getMonth(), to.getDay()
);
return days * 86400;
}
public long getMinutesBetweenTwoDay(Date from, Date to) {
int days = new Date().countDaysBetweenTwoDate(
from.getYear(), from.getMonth(), from.getDay(), to.getYear(), to.getMonth(), to.getDay()
);
return days * 1440;
}
public long getHoursBetweenTwoDay(Date from, Date to) {
int days = new Date().countDaysBetweenTwoDate(
from.getYear(), from.getMonth(), from.getDay(), to.getYear(), to.getMonth(), to.getDay()
);
return days * 24;
}
}