How to convert date from MM/YYYY to MM/DD/YYYY in Java

后端 未结 4 1210
名媛妹妹
名媛妹妹 2021-01-25 03:55

I want to convert date from MM/YYYY to MM/DD/YYYY, how i can do this using SimpleDateFormat in Java? (Note: DD can be start date of that month)

4条回答
  •  孤街浪徒
    2021-01-25 04:12

    The simplest approach is using string manipulation.

    String date1 = "12/2010";
    String date2 = date1.replace("/","/01/");
    

提交回复
热议问题