您的当前位置:首页时间转换的问题

时间转换的问题

2024-12-14 来源:哗拓教育
public class ConvertTest {
    public static void main(String[] args) {
        System.out.println(Date.valueOf("2017-04-10 21:43:54"));
    }
}
报错
Exception in thread "main" java.lang.IllegalArgumentException
    at java.sql.Date.valueOf(Date.java:143)
    at ConvertTest.main(ConvertTest.java:8)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

显示全文