Date and Time

In this assignment we were to code using code academy and complete the assignment called “Date and Time.” In this assignment we were use the “datetime” library and string that we had learned about in our previous lecture to get the current date. We also changed the order of the date from year/month/day to month/day/year using : print ‘%s/%s/%s’ % (now.month, now.day, now.year) format and print statement. Also we got the time to hour:minute:second using :  print ‘%s:%s:%s’ % (now.hour, now.minute , now.second) format and print statement.

dt-0

# 1 The datetime Library

# 1 The datetime Library

dt-2

# 2 Getting the Current Date and Time

dt-3

# 3 Extracting Information

dt-4

# 4 Hot Date

dt-5

# 5 Pretty Time

dt-6

# 6 Grand Finale

While doing this assignment I had no problem. In fact the assignment was quite easy. We used strings and % where  “% operator will fill the %spaceholders in the string on the left with the strings in the parentheses on the right.” This allowed us to used : and / in time and date.

By : Simran Sandhu