Date in Python? | Sololearn: Learn to code for FREE!


Date in Python?

How do I get date from python like 1pm when it is 1pm?

11/3/2018 1:22:52 AM

Isak Nilsson

4 Answers

New Answer


from datetime import datetime # both time & date print( # only date print( # only time print( # hh:mm:ss AM/PM format print("%I:%M:%S %p")) Check out the docs for more:


Kishalaya has answered well, just notice that on SoloLearn, the time will be of SoloLearn's server but not your device, because codes are executed there and then return the result to ours


You're welcome, Skrub !