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
package mobvista.prd.datasource.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by superwood
* Product: IntelliJ IDEA
* Date: 16/12/2
* Time: 18:11
* package: mobvista.dmp.util
* function: todo
*/
public class Standardizer {
public static String standardizingGender(String gender){
switch (gender) {
case "f":
return "female";
case "m":
return "male";
default:
return "unknown";
}
}
/**
* Compare date int.
*
* @param dateLeft the date left 比较的左边 yyyy-mm-dd格式
* @param dateRight the date right 比较的右边 yyyy-mm-dd格式
* @return the int the value <code>0</code> if the argument Date is equal to
* this Date; a value less than <code>0</code> if this Date
* is before the Date argument; and a value greater than
* <code>0</code> if this Date is after the Date argument.
*/
public static int CompareDate(String dateLeft, String dateRight) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date dateTimeLeft = dateFormat.parse(dateLeft);
Date dateTimeRight = dateFormat.parse(dateRight);
return dateTimeLeft.compareTo(dateTimeRight);
}
/**
* Compare date int.
*
* @param dateLeft the date left
* @param dateRight the date right
* @return the int the value <code>0</code> if the argument Date is equal to
* this Date; a value less than <code>0</code> if this Date
* is before the Date argument; and a value greater than
* <code>0</code> if this Date is after the Date argument.
*/
public static int CompareDate(Date dateLeft, Date dateRight){
int compareResult = dateLeft.compareTo(dateRight);
return compareResult;
}
}