1,在学习格式化日期,写了一个小例子:package com;
public class HelloWorld {
public static void main(String[] args) {
Date today = new Date();
String a = String.format("%f", today);
System.out.println("hello world!");
}
}
显然错了,修改:
package com;
import java.util.Date;
public class HelloWorld {
public static void main(String[] args) {
Date today = new Date();
String a = String.format("%f", today);
System.out.println(a);
}
}
仍然错误,为什么,怎么修改才能达到我想要的目的(按照2014-12-25的格式输出日期)呢?
|
|