The Grand Finale 6/6 Date and Time


What am I doing wrong?

The repeated code jumps out, right away. Two lines can be removed from the top. Going to try to test the (repaired) code but it would sure be easier if you pasted it in so we could capture it.

Edit:

Tested and passes.

@hyperfool,
google search
== discussions / opinions=
python datetime.now() explained site:stackoverflow.com
= http://stackoverflow.com/questions/415511/how-to-get-current-time-in-python
= http://stackoverflow.com/questions/4071924/python-datetime-of-a-specific-timezone

Also tested and passed…

from datetime import datetime

now = datetime.now()

now_tuple = (now.month,now.day,now.year,now.hour,now.minute,now.second)

now_format = "%s/%s/%s %s:%s:%s"

print now_format % now_tuple

OR in different format…

from datetime import datetime

now = datetime.now()

now_tuple = (now.month,now.day,now.year,now.hour,now.minute,now.second)

now_format =  "%s/%s/%s %d:%02d:%02d"

print now_format % now_tuple
1 Like

Hello I was also having problems with the date time grand finale so I see that the code you wrote works, but I don’t understand the tuple because the instructions never mention that part of the tuple. can you please explain your way. thank you

Python 5.3 Tuples and Sequences

Sir, can you give us your version to explain tuple? Kindly APPRECIATED!

What part of the above documentation do you not understand? I don’t have my own version since the docs are largely sufficient explanation. What can I add?

1 Like

no problem sir. i understand!

I was doing the same thing… use now.day instead of now.date and it will work.

A post was split to a new topic: Not in the right time format?