去掉"MM.dd"格式的日期中的首位0
/**
* 去掉"MM.dd"格式的日期中的首位0
* @param dateStr
* @return
*/
public static String formatDateFirstBit(String dateStr) {
String dateStr1 = dateStr.substring(0, 1);
String dateStr2 = dateStr.substring(3, 4);
String a = "";
String b = "";
//00
if ("0".equals(dateStr1) && "0".equals(dateStr2)) {
a = dateStr.substring(1,3);
b = dateStr.substring(4,5);
}
//01
if ("0".equals(dateStr1) && !"0".equals(dateStr2)) {
a = dateStr.substring(1,5);
}
//10
if (!"0".equals(dateStr1) && "0".equals(dateStr2)) {
a = dateStr.substring(0,3);
b = dateStr.substring(4,5);
}
//11
if (!"0".equals(dateStr1) && !"0".equals(dateStr2)) {
a = dateStr.substring(0,5);
}
return a + b;
}