How to get first/last day of the previous month?

Mike Driscoll kyosohma at gmail.com
Tue Jan 20 09:54:16 EST 2009


On Jan 20, 8:19 am, Hussein B <hubaghd... at gmail.com> wrote:
> Hey,
> I'm creating a report that is supposed to harvest the data for the
> previous month.
> So I need a way to get the first day and the last day of the previous
> month.
> Would you please tell me how to do this?
> Thanks in advance.

I recommend the dateutil module:

http://labix.org/python-dateutil

I think it may also be possible to use the datetime module, but it's
easier to just use dateutil.

Mike



More information about the Python-list mailing list