On Apr 16, 10:18 am, [EMAIL PROTECTED] wrote: > Matt> from time import mktime > Matt> def secondsInMonth(year, month): > Matt> s1 = mktime((year,month,1,0,0,0,0,0,-1)) > Matt> s2 = mktime((year,month+1,1,0,0,0,0,0,-1)) > Matt> return s2-s1 > > Probably won't work if month==12. ;-) > > Skip
Actually, mktime as described in the C Standard does not restrict members such as tm_mon of struct tm to the range 0-11 (1-12 for the corresponding entry in the time tuple in Python). So the underlying struct in CPython may be normalized and return a perfectly valid time even if month is > 12. -- Regards, Steven -- http://mail.python.org/mailman/listinfo/python-list