Java格式化输出时间

2017-04-24  本文已影响9人  133sheiya
 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  SimpleDateFormat simpleDateFormat2 = new      SimpleDateFormat("yyyy年MM月dd日hh时mm分ss秒");
try {


    Date date = simpleDateFormat.parse("2017-8-11 18:30:38");
    System.out.println(simpleDateFormat2.format(date));
} catch (ParseException | java.text.ParseException e) {
    // TODO: handle exception
    e.printStackTrace();
}
上一篇下一篇

猜你喜欢

热点阅读