Lab 3:Date and Time

lab 3

 

Description: In this lab we had to learn how to input time and date in to python.we first learned by finding out how to input the the month, the date, and then the year. After that they showed use how to put the date up formally. So after we learned how to do that we moved onto the time. From there we input the hour, minutes, and seconds. The end results would then come out to be the date next to the time and that’s your final result.

Code:

from datetime import datetime
now = datetime.now()
current_hour = now.hour
current_minute = now.minute
current_second = now.second
current_month = now.month
current_date= now.date
current_year= now.year

print str(now.month) + “/” + str(now.day) + “/” + str(now.year), str(now.hour) + “:” + str(now.minute) + “:” + str(now.second)