美文网首页
Java格式化输出时间

Java格式化输出时间

作者: 133sheiya | 来源:发表于2017-04-24 15:59 被阅读9次
 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();
}

相关文章

网友评论

      本文标题:Java格式化输出时间

      本文链接:https://www.haomeiwen.com/subject/gxepzttx.html