Unparsable date exception

前端 未结 5 1178
我在风中等你
我在风中等你 2021-01-21 21:37

I\'m currently working on some simple project in Java and I have date in the following string:

String dateString = \"Sun 7/14 03:44 AM 2013\";
         


        
5条回答
  •  终归单人心
    2021-01-21 21:53

    I tried this out and the following worked,

            String stringDate = "Sun 7/14 03:44 AM 2013";
            DateFormat format = new SimpleDateFormat("EEE MM/dd hh:mm a yyyy");
    
            System.out.println("Parsed Date = "+format.parse(stringDate));
    

    The output was as follows

    Parsed Date = Sun Jul 14 03:44:00 BST 2013
    

提交回复
热议问题