mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-11 03:13:51 +00:00
chore[util]: surround exception for stringToDate in TimeUtils
This commit is contained in:
1 parent
fb777bf203
commit
2008a8117e
1 file changed
+12
-5
@@ -94,10 +94,13 @@ public abstract class TimeUtils {
|
||||
*
|
||||
* @param dateString 日期字符串,如:2018-02-12 10:12:50
|
||||
* @return <code>Date</code>
|
||||
* @throws ParseException 解析异常
|
||||
*/
|
||||
public static Date stringToDate(String dateString) throws ParseException {
|
||||
return DATE_FORMAT.get().parse(dateString);
|
||||
public static Date stringToDate(String dateString) {
|
||||
try {
|
||||
return DATE_FORMAT.get().parse(dateString);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,8 +121,12 @@ public abstract class TimeUtils {
|
||||
return SIMPLE_DATE_FORMAT.get().format(new Date(now()));
|
||||
}
|
||||
|
||||
public static Date dayStringToDate(String dateString) throws ParseException {
|
||||
return DATE_FORMAT_FOR_DAY.get().parse(dateString);
|
||||
public static Date dayStringToDate(String dateString) {
|
||||
try {
|
||||
return DATE_FORMAT_FOR_DAY.get().parse(dateString);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
// --------------------------------------日期判断--------------------------------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user