java date problem in parsing

后端 未结 4 700
广开言路
广开言路 2020-11-28 16:58

I am parsing a date, where I am passing 2011-02-10 00:00:00:0, and I am getting 2011-01-10 as the result. Is this wrong? Please help.

4条回答
  •  暖寄归人
    2020-11-28 17:37

    try using MM instead of mm should work

    refer http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

     M  Month in year   Month   July; Jul; 07
     m  Minute in hour  Number  30
    

    an example

    "yyyy-MM-dd HH:mm:ss:SSS"   2001-07-04 12:08:56:235
    

提交回复
热议问题