kode2go / python

Lessons on learning python programming.
0 stars 0 forks source link

Python Exercises: Q3 #3

Open kode2go opened 3 years ago

kode2go commented 3 years ago
  1. Write a Python program to display the current date and time. Sample Output :
    Current date and time :
    2014-07-05 14:34:14
kode2go commented 3 years ago
from datetime import datetime
currentDate=(datetime.now())
currentDateStr=str(datetime.now())
print(currentDate.strftime("%Y-%M-%d %H-%M-%S"))
print(currentDateStr[0:19])