Date and Time | Grand Finale


#1



https://www.codecademy.com/courses/python-beginner-en-zFPOx/0/6?curriculum_id=4f89dab3d788890003000096#


Oops, try again. Your printed date and time do not seem to be in the right format: mm/dd/yyyy hh:mm:ss
but in the operator it say's this: 9-22-2016 18:28:32
None


it doesn't work... i didn't know why...


from datetime import datetime
now = datetime.now()

print ('%s-%s-%s %s:%s:%s') % (now.month, now.day, now.year, now.hour, now.minute, now.second)


#2

The instruction says:

Put slashes and colons and a space between the placeholders so that they fit the format above.

And this is a sample.

'%s/%s/%s %s:%s:%s'

#3

Hello

In your code you have 9-22-2016, the format is 9/22/2016.
Just change in your code - to /.

Hope that helps.


#4

Thanks!!! it was a stupid mistake but now it is good!


#5

Now you won't forget - its all in the details.


#6

A post was split to a new topic: Date time grand finale


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.