| | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | return berlinZonedTime.format(formatter); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String start="2025-12-04 22:37:22"; |
| | | Date startTime= Date.from( |
| | | LocalDateTime.parse(start, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
| | | .atZone(ZoneId.systemDefault()) |
| | | .toInstant() |
| | | ); |
| | | Date date=new Date(); |
| | | System.out.println(dateNum(startTime, date));; |
| | | } |
| | | |
| | | } |