Write a Python program to display the current date and time


Introduction

Write a Python program to display the current date and time. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. import datetime
  2. now = datetime.datetime.now()
  3. print ("Current date and time : ")
  4. print (now.strftime("%Y-%m-%d %H:%M:%S"))

Result

python language techstudy.org

     





Related Topics




Popular Posts