Monday, March 30, 2015

How to use JODA time lib in Grails Application

first go to

https://github.com/JodaOrg/joda-time/releases

download latest version of joda tile lib and put it in "lib" folder of grails app

then import

import org.joda.time.DateTime;
import org.joda.time.Days;
import java.util.Date;

then here is a exmple to find difference between dates.

                   Date future = job.applyBefore;
        Date today = new Date();

        int Days = Days.daysBetween(new DateTime(today), new                 DateTime(future)).getDays();


you have used joda time lib :) 

0 comments:

Post a Comment