script for seconds in given month?

skip at pobox.com skip at pobox.com
Mon Apr 16 19:18:29 CEST 2007


    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



More information about the Python-list mailing list