Parse String timestamp to Instant throws Unsupported field: InstantSeconds

A simpler method is to add the default timezone to the formatter object when declaring it

final DateTimeFormatter formatter = DateTimeFormatter
                                    .ofPattern("yyyy-MM-dd HH:mm:ss")
                                    .withZone(ZoneId.systemDefault());
Instant result = Instant.from(formatter.parse(timestamp));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)