Implement the dateInEpochSeconds() method that accepts some text representing an Instant unit and prints the long equivalent of that unit. For this task, you should use the getEpochSecond() method to parse an Instant unit to a long value.
Computer scienceProgramming languagesJavaAdditional instrumentsEssential standard classesDate and time
Instant
The Instant to a long
Report a typo
Sample Input 1:
1991-04-15T17:30:00ZSample Output 1:
671736600Write a program in Java 17
import java.util.Scanner;
import java.time.Instant;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println(dateInEpochSecond(scanner.nextLine()));
}
public static long dateInEpochSecond(String text) {
}
}
___
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.