CustomStringUtils.java
1.09 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
37
38
39
40
package com.bsth.data.utils;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by panzhao on 2017/7/10.
*/
public class CustomStringUtils {
public static boolean equals(String s1, String s2){
if(s1 == null){
if(StringUtils.isNotEmpty(s2))
return false;
else
return true;
}
return s1.equals(s2);
}
public static String maxEndTime(String sStr, String eStr, int space) throws ParseException {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
long st = sdf.parse(sStr).getTime();
long et = sdf.parse(eStr).getTime();
long dayTime = 24 * 60 * 60 * 1000;
long spaceTime = dayTime * space;
if (et - st > spaceTime) {
eStr = sdf.format(new Date(st + spaceTime));
}
} catch (Exception e) {
throw e;
}
return eStr;
}
}