- public static void main(String[] args) {
- for (int i = 0; i < 10; i++) {
- System.out.println(String.format("%06d", 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>
- }
- %06d :
- %是格式化输入接受参数的标记
- 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
时间: 2024-10-05 18:34:09