[IronPython] script for seconds in given month, year

edfialk edfialk at gmail.com
Mon Apr 23 22:31:41 CEST 2007

Hello, I'm looking for a way to provide month and year, and return the
number of seconds in that month.  My range will be roughly from
01/01/1960 to 12/31/2000 for now.

I originally thought we would be working with regular Python and asked
in the Python group, to which I got a great, working Python script:

import calendar

def seconds_in_month(month, year):
    nomatter, daysinmonth = calendar.monthrange(year, month)
    return daysinmonth * 24 * 60 * 60

Unfortunately, in IronPython the calendar module does not import:
SyntaxError: unexpected token TimeEncoding (c:\Python25\Lib
\calendar.py, line 510)

So, does anyone happen to know of a script that could perform this in

Any help would be greatly appreciated.

More information about the Ironpython-users mailing list