Home  »  CodeSnippets   »   Get the Current Year in Python

Get the Current Year in Python

Posted: February 6, 2022 | by Site Host

Using DateTime:

import datetime
now = datetime.datetime.now().year


from datetime import date
year = date.today().year

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

See also  How to Display Text With Multiple Colors in CSS