新增 动态消息转历史数据 定时器功能
This commit is contained in:
@@ -38,4 +38,33 @@ public class DateTimeUtil {
|
||||
throw new RuntimeException("日期转换失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转日期
|
||||
* @param strDate 字符串的日期
|
||||
* @param pattern 日期格式
|
||||
* @param locale
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static Date toDate(String strDate,String pattern,Locale locale)
|
||||
{
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern,locale);
|
||||
return sdf.parse(strDate);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
throw new RuntimeException("日期转换失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今天最小时间 单位秒
|
||||
* @return
|
||||
*/
|
||||
public static Long getTodayStartTime(){
|
||||
String time = DateTimeUtil.gtFormatStr(new Date(), "yyyy-MM-dd",Locale.ENGLISH)+" 00:00:00";
|
||||
return DateTimeUtil.toDate(time,"yyyy-MM-dd HH:mm:ss").getTime();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user