Obtain an Instant unit from seconds and convert it to an OffsetDateTime.
Computer scienceProgramming languagesJavaAdditional instrumentsEssential standard classesDate and time
ZonedDateTime and OffsetDateTime
Get the OffsetDateTime unit
Report a typo
Sample Input 1:
123456789Sample Output 1:
1973-11-30T01:33:09+04:00Write 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) {
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.