public static void main(String[] args) throws ParseException{ //先转成日期 String fmt = "yyyyMM"; SimpleDateFormat sdf = new SimpleDateFormat(fmt); Date date = sdf.parse("201404"); //再转样式 fmt = "yyyy.MM"; sdf = new SimpleDateFormat(fmt); String str = sdf.format(date); System.out.println("str=" + str); }
原文:http://www.cnblogs.com/zhaoding/p/6251556.html