import java.time.LocalDateTime;
import java.time.Period;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
public class probaEdade {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
System.out.println("Introduzca a súa data de nacemento en formato dd/mm/aaaa"
+ " (exemplo. 01/10/1995");
String fechNac = teclado.nextLine();
//----------partimos fecha nac 15/12/1972
String fechNac1[]=fechNac.split("/");
int fechN[]= new int[fechNac.length()];
//-------------las metemos en array de tipo int fechN[2], fechN[1], fechN[0]
for(int i=0;i<fechNac1.length;i++) {
fechN[i]= Integer.parseInt(fechNac1[i], 10);
}
//------fecha hora y lugar
LocalDateTime fechNac23 = LocalDateTime.of(fechN[2], fechN[1], fechN[0], 13, 45);
ZoneId lugarNac = ZoneId.of("Asia/Tokyo");
ZonedDateTime fechLugarNac = ZonedDateTime.of(fechNac23, lugarNac);
System.out.println(fechLugarNac); //1972-12-15T13:45+09:00[Asia/Tokyo]
//----ahora
LocalDateTime ahora = LocalDateTime.now();
ZoneId estamosEn = ZoneId.of("Europe/Madrid");
ZonedDateTime fechLugarAhora = ZonedDateTime.of(ahora, estamosEn);
System.out.println(fechLugarAhora);
double diasEdad= ChronoUnit.DAYS.between(fechLugarNac, fechLugarAhora);
long horasEdad = TimeUnit.DAYS.toHours((long) diasEdad);
System.out.println(diasEdad+" años en dias");
System.out.println(horasEdad+" los años en horas");
}
}