-3

I need to convert Convert String TimeStamp"2016-12-26 19:26:36.915" To Standard Timestamp format "yyyy-MM-dd hh:mm:ss.sss" using core java.

Please help me out the standard way to code this.

Youcef LAIDANI
  • 55,661
  • 15
  • 90
  • 140

1 Answers1

-1
    try{
    String inputTime = "2016-12-26 19:26:36.915";
    String date_format = "yyyy-MM-dd hh:mm:ss.sss";
    DateFormat dateFormat = new SimpleDateFormat(date_format);

    //You will get a date object below from String you provide
    Date date = dateFormat.parse(inputTime);
    }catch(ParseException exception){
        System.out.println(exception.toString());
    }