PYTHON Is there a way I can get the year difference between two dates? -
i'm developing small program insurance company see how old person (this changes ranges of cover can offer). can calculate different in years not take account days/months. there way of doing without importing things elsewhere?
thanks
as working python must use datetime module. lets have look.
from datetime import datetime bday = '1978/11/21' dt = datetime.strptime(bday, '%y/%m/%d') diff = datetime.now() - dt diff.days
gives 13764
Comments
Post a Comment