On Sep 19, 7:22 pm, Schif Schaf <schifsc...@gmail.com> wrote: > The other day I needed to convert a date like "August 2009" into a > "seconds-since-epoch" value (this would be for the first day of that > month, at the first second of that day). > > In Python, I came up with this: > > ~~~~ > #!/usr/bin/env python > > import datetime > import time > > time_in_sse = time.mktime( > datetime.datetime(2009, 8, 1).timetuple() > ) > > print time_in_sse > ~~~~ > > I *wanted* to just use time.mktime(), but it wouldn't work unless I > could specify the *complete* time tuple value (who would have all that > handy?!).
Was it really that hard to add a few zeros to the tuple for values you didn't know? time.mktime((2009, 8, 1, 0, 0, 0, 0, 0, -1)) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list