The Instant to a long

Report a typo

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.

Sample Input 1:

1991-04-15T17:30:00Z

Sample Output 1:

671736600
Write 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) {

}
}
___

Create a free account to access the full topic