# of Months between two dates

Jason Friedman jsf80238 at gmail.com
Fri Apr 6 00:03:07 EDT 2018


>
> > > I've written a function to return the months between date1 and date2
> but
> > > I'd like to know if anyone is aware of anything in the standard library
> > > to do the same?  For bonus points, does anyone know if postgres can do
> > > the same (we use a lot of date/time funcitons in postgres, already, but
> > > didn't see this problem addressed).
>


> > It's probably better to write the function yourself according to what
> > makes sense in your use-case, and document its behaviour clearly.
>

I suggest using the dateutil module (
https://pypi.python.org/pypi/python-dateutil) before writing your own.



More information about the Python-list mailing list