System.out.printf("%tc\n",new Date());
System.out.printf("%tF\n",new Date());
//必须以t开始 以格式化参数结束
System.out.printf("%tQ\n",new Date());
//多段日期的格式化
System.out.printf("%1$s %2$tY, %2$tm %2$td","Due Date:",new Date());
System.out.printf("%tF\n",new Date());
//必须以t开始 以格式化参数结束
System.out.printf("%tQ\n",new Date());
//多段日期的格式化
System.out.printf("%1$s %2$tY, %2$tm %2$td","Due Date:",new Date());
本文展示了几种使用Java进行日期格式化的实例代码,包括如何使用System.out.printf方法来输出不同格式的日期。

2260

被折叠的 条评论
为什么被折叠?



