Hi All, Any updates please I ran this method today with no error :D . On Tue, Mar 31, 2009 at 10:51 PM, basem zohdy <bassem.zo...@gmail.com>wrote:
> Hi All, > I get this behaviour can any one tell me what is reason: > I have this method > ---------------------------------------------------------------------------------------------------------------------------------------------- > > import java.util.Calendar; > import java.util.Date; > > import org.joda.time.DateTime; > import org.joda.time.Days; > import org.joda.time.Months; > import org.joda.time.Years; > ... > static public Integer computeMonthDiff(Date dateA, Date dateB) { > if( dateA == null || dateB == null ) > return null; > > DateTime dtA = new DateTime( dateA ).withHourOfDay( 0 > ).withMinuteOfHour( 0 ).withSecondOfMinute( 0 ).withMillisOfSecond( 0 ); > DateTime dtB = new DateTime( dateB ).withHourOfDay( 0 > ).withMinuteOfHour( 0 ).withSecondOfMinute( 0 ).withMillisOfSecond( 0 ); > > return Months.monthsBetween( dtA, dtB ).getMonths(); > } > --------------------------------------------------------------------------------------------------------------------------------------------- > > when calling it in debuging mode I get this results, in the below the > watches values at the return line > > dtA.getMonthOfYear() =5 > dtB.getMonthOfYear() =3 > but > Months.monthsBetween( dtA, dtB ).getMonths() = -1 > and it should be -2 > > I ran this method at 31/March/2009,I think it could be because of this date > spicily, and will not run after. > > Thank you > Bassem R. Zohdy > bassem.zo...@gmail.com > +971501057058 > -- Bassem R. Zohdy bassem.zo...@gmail.com +971501057058
------------------------------------------------------------------------------
_______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest