getting month name wrong with SimpleDateFormat

前端 未结 2 1511
渐次进展
渐次进展 2021-01-19 05:15

I am having problem with this small piece of code

SimpleDateFormat sf = new SimpleDateFormat(\"yyyy-mm-dd HH:mm:ss\");

String str = \"2010-03-13 01:01:22\";         


        
2条回答
  •  梦谈多话
    2021-01-19 05:51

    You are using minute instead of month in your pattern. It should be:

    yyyy-MM-dd HH:mm:ss
    

提交回复
热议问题