Get Time in 24 Hour Format with Python in Terminal on Mac - VicPhanDevOps/mac GitHub Wiki

• Press the command key and spacebar to launch Spotlight Search, type “terminal” and select the “Terminal” application.
image

• Type python3 and press the return key to get into the Python interactive shell.
image

• Type from datetime import datetime and press the return key to import the datetime module.
image

• Type datetime.now().strftime(“%H:%M”) and press the return key to get the time in 24-hour format.
image

⚠️ **GitHub.com Fallback** ⚠️