(python2.7)
忘れるんでメモ
標準ライブラリのみで
In [16]: import datetime In [17]: today = datetime.datetime.today() In [18]: today.strftime('%Y-%m-%d') Out[18]: '2016-02-12' In [19]: d = today + datetime.timedelta(days=30) In [21]: d.strftime('%Y-%m-%d') Out[21]: '2016-03-13'
追記:ワンライナー
$ python -c "import datetime; print(datetime.datetime.today() + datetime.timedelta(days=30))" 2016-03-13 22:20:41.283471