Dec-25-2023, 08:29 AM
Happy Christmas!
You need datetime! Look up the docs for all the %letter parameters.
You need datetime! Look up the docs for all the %letter parameters.
from datetime import datetime now = datetime.now() print(now.strftime('Hour (00-11) : %I')) print(now.strftime('AM/PM : %p')) print(now.strftime('%I%p')) hour = now.strftime('%I%p') if hour == '05PM': do something