*/
ONLY_MONTH_DAY {
public String getValue() {
return “MM-dd”;
}
},
/**
- 格式:“MM-dd HH:mm”
*/
ONLY_MONTH_SEC {
public String getValue() {
return “MM-dd HH:mm”;
}
},
/**
- 格式:“HH:mm:ss”
*/
ONLY_TIME {
public String getValue() {
return “HH:mm:ss”;
}
},
/**
- 格式:“HH:mm”
*/
ONLY_HOUR_MINUTE {
public String getValue() {
return “HH:mm”;
}
};
public abstract String getValue();
}
/**
- 获取当前时间 格式---->2019-08-04 13:30:29
*/
public static String getNowTime(DateFormat format) {
String nowtime = null;
Calendar calendar = Calendar.getInstance();
Date dateNow = calendar.getTime();
SimpleDateFormat sdf = new SimpleDateFormat(format.getValue(), Locale.CHINA);
nowtime = sdf.format(dateNow);
return nowtime;
}
/**
-
将一个日期字符串转换成Data对象 string–>date
-
@param dateString 日期字符串<