abdeen-ahmad
12/10/2015 - 1:43 PM

Get ages between #CVL project

Get ages between #CVL project

import java.text.SimpleDateFormat;
import java.util.Date;
public class HelloWorld{
     public static void main(String []args){
 Date date = new Date();  
        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); 
        String strDate = formatter.format(date);
        formatter = new SimpleDateFormat("yyyy");  
        strDate = 1 + formatter.format(date).toString().substring(2); 
        //strDate = strDate.toString();
        // strDate = 1 + strDate.substring(2);
        int y =  Integer.valueOf(strDate);
        //System.out.println(y);
        String Bday = "01/01/90";
        int Bdayint = Integer.valueOf(Bday.substring(6));
        int sum = y-Bdayint;
        System.out.println(y + " - " + Bdayint + " = " +  sum );
        // Date datenow = new Date();  
        //        SimpleDateFormat formatter2 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); 
        //        String sysdtae = formatter2.format(datenow);
        //        System.out.println(sysdtae);
                System.out.println("Today Code");
        int xx = 25;
        int yy = 35;
         System.out.println("Ages between " + xx +" and "+ yy);
         System.out.println(strDate);
          xx = y - xx;
          yy = y- yy;
         System.out.println(xx + " - " + yy  );
     }
}