调整包路径
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.gzzn.omms.msgexchangeapi.utils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@@ -17,4 +18,24 @@ public class DateTimeUtil {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern,locale);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 字符串转日期
|
||||
* @param strDate 字符串的日期
|
||||
* @param pattern 日期格式
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static Date toDate(String strDate,String pattern)
|
||||
{
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
return sdf.parse(strDate);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
throw new RuntimeException("日期转换失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user