实验报告
This commit is contained in:
@@ -436,6 +436,15 @@ public class DateUtils extends PropertyEditorSupport {
|
||||
return getSdFormat(pattern).format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
public static String formatDate(String dateStr, String pattern) {
|
||||
try {
|
||||
Date date = parseDate(dateStr, "yyyy-MM-dd HH:mm");
|
||||
return getSdFormat(pattern).format(date);
|
||||
} catch (ParseException e) {
|
||||
return dateStr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期按指定格式显示
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user