My question is how to get a string and manipulate it. The user will enter dd / mm / yyyy in the form of String
. How do I do this capture? And then I need to turn that date into an integer so I can do the validations, such as if the reported day does not exceed 31.
For example, the user will report the following String
: "3/21/2014", and I need to get this string and pass it as a parameter to a method.
My code is as follows:
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
TAD01 verificacoes = new TAD01();
String data;
boolean resultado;
System.out.print("Informe a data: ");
data = input.nextLine();
resultado = verificacoes.converteData(data);
System.out.println(data);
}
Thank you all at once.