-
-
Save parzibyte/8995d25d700fef47a1482c4bb61104a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.DateTimeFormatterBuilder; | |
class Main { | |
public static void main(String[] args) { | |
String fechaCadena = "2022-08-05 22:51:53"; | |
DateTimeFormatter formateador = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toFormatter(); | |
LocalDateTime fecha = LocalDateTime.parse(fechaCadena, formateador); | |
System.out.println(fecha); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment