2011-04-29 10 views

回答

1

當然有。只需使用正確的語言環境。例如:

Date now = new Date(); 
    DateFormat monthFormat = new SimpleDateFormat("MMMM", Locale.FRENCH); 
    String currentMonth = monthFormat.format(now); 

通過類似的模式可以訪問日期名稱。其他例子:

DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, Locale.GERMAN); 
    String date = df.format(now); 

不過,我會建議使用默認模式:

DateFormat dateFormat = DateFormat.getDateTimeInstance(
      DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.ITALIAN); 
    String defaultDateTime = dateFormat.format(now); 

正如你可以看到它的工作原理就像在其它基於Java的應用程序。這是除非你要求基於Python的GAE ...

+0

所以對不起,我忘了提及它是爲Python!無論如何感謝! – ana 2011-05-01 23:46:25

相關問題