日期转换


public static int getYYYYMMDD(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
int tmp = 0;
try {
tmp = Integer.valueOf(sdf.format(date));
} catch (Exception e) {
log.error("时间转换异常date={} e={}", date, e);
throw new RuntimeException("时间转换异常");
}
return tmp;
}
posted @ 2018-02-23 17:43  withoutaword  阅读(129)  评论(0编辑  收藏  举报