Lab 3: Date and Time

Description: Learned how to use current date and time in Python and how to print them out in the standard format.

Code:

from datetime import datetime
now= datetime.now ()
print now
date = str(now.month) + “/” + str(now.day) + “/” + str(now.year)
time = str(now.hour) + “:” + str(now.minute) + “:” + str(now.second)
print date + ” ” + time

ScreenShot:

 untitled

Leave a Reply

Your email address will not be published. Required fields are marked *