check current hour in python code example Example: get the current year in python Click to copyimport datetime now = datetime.datetime.now().year print(now)