SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); Date date = sdf.parse("201508"); String s =new java.text.SimpleDateFormat("yyyyMM01").format(date); System.out.print(s);