Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/05/2007, 16:39
laudrup
 
Fecha de Ingreso: febrero-2007
Mensajes: 172
Antigüedad: 17 años, 3 meses
Puntos: 0
problema con las fechas

utilizo la siguiente funcion para pedir que introduzcan una fecha por pantalla,el dia lo hace bien,pero el mes y el año no los pone correctamente.Cual es el fallo??

private static Date fechainicio() throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("Introduce la fecha de inicio");
System.out.println("Dia:");
String d = br.readLine();
int dia = Integer.parseInt(d);
System.out.println("Mes:");
String m = br.readLine();
int mes = Integer.parseInt(d);
System.out.println("año:");
String a = br.readLine();
int anyo = Integer.parseInt(a);
Date fecha=new Date(anyo,mes,dia);
return fecha;
}