date - Java 8 - Trying to convert String to LocalDateTime -


this question has answer here:

i trying convert below string localdatetime, somehow not working.

val formatter = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm:ss.sss"); val datetime = localdatetime.parse("2016-09-21 13:43:27.000", formatter); 

it seems there problem in pattern.

you have problem pattern, should use 'h' hours(0-23). type formatter , datetime wrong. work correctly:

    datetimeformatter formatter = datetimeformatter.ofpattern("yyyy-mm-dd hh:mm:ss.sss");     localdatetime datetime = localdatetime.parse("2016-09-21 13:43:27.000", formatter); 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -