9951 explained code solutions for 126 technologies


python-pandasGet current year


from datetime import datetime

currentYear = datetime.now().yearctrl + c
from datetime import datetime

import datetime utility to operate with time

datetime.now()

returns current date object

.year

attribute returns year

currentYear

will contain current year