时间转换的问题

2017-07-28  本文已影响5人  暴打程序员
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)

上一篇下一篇

猜你喜欢

热点阅读