Get the OffsetDateTime unit

Report a typo

Obtain an Instant unit from seconds and convert it to an OffsetDateTime.

Sample Input 1:

123456789

Sample Output 1:

1973-11-30T01:33:09+04:00
Write a program in Java 17
import java.util.Scanner;
import java.time.*;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
OffsetDateTime offsetDateTime = convertToOffsetDateTime(scanner.nextLong(), ZoneId.of("Asia/Yerevan"));

System.out.println(offsetDateTime);
}

public static OffsetDateTime convertToOffsetDateTime(long epochSeconds, ZoneId zoneId) {

}
}
___

Create a free account to access the full topic