Bài 20: DatePickerDialog và TimePickerDialog trong Android (P3)

Leave a Comment
- Sau đây là nội dung xử lý các nghiệp vụ:
20_time_3- Class JobInWeek để định nghĩa một công việc phải hoàn thành trong một tuần.
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package tranduythanh.com;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
 * Class được định nghĩa công việc phải hoành thành
 * trong một tuần
 * @author drthanh
 *
 */
public class JobInWeek {
 private String title;
 private String desciption;
 private Date dateFinish;
 private Date hourFinish;
 public String getTitle() {
 return title;
 }
 public void setTitle(String title) {
 this.title = title;
 }
 public String getDesciption() {
 return desciption;
 }
 public void setDesciption(String desciption) {
 this.desciption = desciption;
 }
 public Date getDateFinish() {
 return dateFinish;
 }
 public void setDateFinish(Date dateFinish) {
 this.dateFinish = dateFinish;
 }
 public Date getHourFinish() {
 return hourFinish;
 }
 public void setHourFinish(Date hourFinish) {
 this.hourFinish = hourFinish;
 }
 public JobInWeek(String title, String desciption, Date dateFinish,
 Date hourFinish) {
 super();
 this.title = title;
 this.desciption = desciption;
 this.dateFinish = dateFinish;
 this.hourFinish = hourFinish;
 }
 public JobInWeek() {
 super();
 }
 /**
 * lấy định dạng ngày
 * @param d
 * @return
 */
 public String getDateFormat(Date d)
 {
 SimpleDateFormat dft=new
 SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
 return dft.format(d);
 }
 /**
 * lấy định dạng giờ phút
 * @param d
 * @return
 */
 public String getHourFormat(Date d)
 {
 SimpleDateFormat dft=new
 SimpleDateFormat("hh:mm a", Locale.getDefault());
 return dft.format(d);
 }
 @Override
 public String toString() {
 return this.title+"-"+
 getDateFormat(this.dateFinish)+"-"+
 getHourFormat(this.hourFinish);
 }
}
Xem tiếp P4....

0 nhận xét:

Đăng nhận xét