美文网首页
SimpleDateFormat

SimpleDateFormat

作者: 四喜汤圆 | 来源:发表于2018-07-20 09:19 被阅读12次

    哎呀!!!!!!!!!!!&#!@*SimpleDateFormat的格式问题

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    

    上面这样式的,调用sdf.parse("2018-07-20")得到的Date是2018-07-20

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
    

    上面这样式的,调用sdf.parse("2018-07-20")得到的Date是2018-01-20【看好喽!!是一月份】

    相关文章

      网友评论

          本文标题:SimpleDateFormat

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