Android(Java)
[Java] Date() DEPRECATION 대체 코드
삽질중
2024. 12. 23. 09:55
해당코드를 사용 했는데 Sparrow 취약점에 걸렸다... 더이상 사용하지 않는다능... Date()
String currentDateTime = DateFormat.getDateTimeInstance().format(new Date());
대체코드
LocalDateTime dt = LocalDateTime.now();
DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT);
String currentDateTime = dt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd, HH:mm:ss"));