Get Time in 12 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.
•
• Type python3
and press the return key to get into the Python interactive shell.
•
• Type from datetime import datetime
and press the return key to import the datetime
module.
•
• Type datetime.now().strftime(“%I:%M %p”)
and press the return key to get the time in 12-hour format.
•