On Apr 16, 6:22 pm, "edfialk" <[EMAIL PROTECTED]> wrote:
> Hi, does anyone happen to know of a script that would return the
> number of seconds in a month if I give it a month and a year?
>

something like this might work, it should event handle DST correctly.
You could read up on mktime() if you want to make sure.

from time import mktime
def secondsInMonth(year, month):
    s1 = mktime((year,month,1,0,0,0,0,0,-1))
    s2 = mktime((year,month+1,1,0,0,0,0,0,-1))
    return s2-s1

/Matt

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to