How to convert string to date and time, from "20220202072442" to 02-02-2022 07:24:42
Asked
Active
Viewed 36 times
0
-
They seem two string to me, look into the String#substring() menthod. https://docs.oracle.com/javase/7/docs/api/java/lang/String.html – Juan Feb 02 '22 at 00:34
-
1`LocalDateTime.parse("20220202072442", DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))` – shmosel Feb 02 '22 at 00:40
-
3@Juan - Doing this conversion using substring is clumsy. – Stephen C Feb 02 '22 at 05:24