public static void main(String[] args) throws SQLException, ParseException {
// List<String> list =new ArrayList<>();
// list=logOn(); //logOn trial
//
// for (String s: list)
// System.out.print(s + " ");
//
// ConnectDB connectDB=new ConnectDB(list); //create connection
// list=connectDB.getList();
//
// System.out.println("OUTPUT LIST :");
// for (String j:list)
// System.out.print(j + " ");
String pesel="1611179345";
String year=pesel.substring(0,2);
String month=pesel.substring(2,4);
String day=pesel.substring(4,6);
Integer yearP=Integer.parseInt(year);
Integer monthP=Integer.parseInt(month);
Integer dayP=Integer.parseInt(day);
System.out.println(yearP);
System.out.println(monthP);
String birthDate="";
if (yearP>=0 && monthP>20 && dayP<=31){ //someone born after 2000
birthDate="20"+year+"/"+(monthP-20)+"/"+day;
// System.out.println(birthDate);
}else if(yearP>=17 && monthP<20 && dayP<=31){
birthDate="19"+year+"/"+(monthP)+"/"+day;
// System.out.println(birthDate);
}else {
System.out.println("za stary;");
}
DateFormat format = new SimpleDateFormat("yyyy/MM/dd");
Date dateb = format.parse(birthDate);
System.out.println(dateb);
// DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
System.out.println(format.format(date));
long diff=date.getTime()-dateb.getTime();
long d=(1000l*60*60*24*365);
long years = Math.round(diff / d);
int age=(int) years;
System.out.println("AGE "+age);
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}