2013-01-02 17 views

回答

4

,您可以改用

String.format("%02d", ...) 
4

使用的SimpleDateFormat:

SimpleDateFormat dateFormat = new SimpleDateFormat("MM"); 
    System.out.println(dateFormat.format(date)); 

而且我也很建議使用Joda Time而不是Java日曆。

相關問題