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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -