Date Comparison

Diez B. Roggisch deets at nospam.web.de
Tue Feb 3 08:34:09 EST 2009


mohana2004 at gmail.com wrote:

> Hi,
> I need to compare two dates and find the number of days between those
> two dates.This can be done with datetime module in python  as below,
> but this is not supported in Jython.
> 
> example
> from datetime import date
> a=datetime.date(2009,2,1)
> b=datetime.date(2008,10,10)
> c= a-b
> c.days
> 114
> 
> Is there any other function to do the same(should be supported by
> Jython)

Use the java API of java.util. That methods like before and after on
date-objects.

Diez



More information about the Python-list mailing list