日期:2014-05-20 浏览次数:20788 次
package com.ibm.lan.test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Scanner; public class DateTest { public static void main(String[] args) { Scanner sn = new Scanner(System.in); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日"); while (true) { String s = sn.nextLine(); try { System.out.println(sdf2.format(sdf.parse(s))); } catch (ParseException e) { e.printStackTrace(); } } } }