public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.out.println(String.format("d", i)); } <strong> System.out.println(String.format("%tF %1$tT",new Date())); System.out.println(String.format("%1$TY-%1$Tm-%1$Td %1$TH:%1$TM:%1$TS",new Date())); </strong> } d : %是格式化输入接受参数的标记 0格式化命令:结果将用零来填充 6:填充位数 d:代表十进制 数据 console: 000001 000002 000003 000004 000005 000006 000007 000008 000009 2013-09-06 17:31:58 2013-09-06 17:31:58
转载请注明原文地址: https://www.6miu.com/read-32336.html