I want difference between two dates i.e from gsp form and current date. From gsp date format is in form 1994-05-19 00:00:00.0 while I am using new Date() for current date it gives date in format of Sun Feb 28 07:42:13 NPT 2016. How could i get difference between these date. My code is:
int getAge(Date dateOfBirth){
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd")
    print(">>>><><><><<<<<<<<<<<<><><><><><><><><")
    print("date of birth");
    print(dateOfBirth)
    print(">>>><><><><<<<<<<<<<<<><><><><><><><><")
    print("current date")
    print(new Date())
    print(">>>><><><><<<<<<<<<<<<><><><><><><><><")
    Date currentDate = new Date()
    def cd = dateFormat.format(currentDate)
    String date = dateFormat.format(dateOfBirth)
    return 5;
}
I am using java 7 and grails 2.3.5
 
    