2015年12月3日 星期四

[ Python 常見問題 ] How to increment datetime by custom months in python without using library?

Source From HereQuestionI need to increment the month of a datetime value. I wanted to use timedelta, but it doesn't take month argument. There is relativedelta python package, but i don't want to install it just only for this. Also there is a solution usingstrtotime. Below is the example usage: