调整包路径

This commit is contained in:
zhouxiunai
2018-11-29 13:33:46 +08:00
parent f8d392d5af
commit 7bfef3b0cd
12 changed files with 178 additions and 66 deletions
@@ -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());
}
}
}