Date Comparison

M

mohana2004

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)

Regards,
Monyl
 
D

Diez B. Roggisch

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
 
M

Mark Wooding

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

I don't understand your problem.

Jython 2.2.1 on java1.6.0_0
Type "copyright", "credits" or "license" for more information. 114

-- [mdw]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top