Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get current time

---------------------------------------------------------
import datetime
 
currentDateTime = datetime.datetime.now()
print(currentDateTime)
---------------------------------------------------------
OR
---------------------------------------------------------
from datetime import datetime
 
currentDateTime = datetime.now()
print(currentDateTime)
---------------------------------------------------------
OR
---------------------------------------------------------
import datetime

print(datetime.datetime.now())
---------------------------------------------------------
OR
---------------------------------------------------------
from datetime import datetime
 
print(datetime.now())
---------------------------------------------------------
Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #python #current #time
ADD COMMENT
Topic
Name
6+5 =