Date & Time error


#1


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

I
error: Your printed date and time do not seem to be in the right format: mm/dd/yyyy hh:mm:ss

I'm sure that I did what it told me to do
Instructions
Print the date and time together in the form: mm/dd/yyyy hh:mm:ss.


from datetime import datetime
now = datetime.now()

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


#2

The instructions indicate that it all needs to be on one line.


#3

You have to print all of it in one line and also the the slashes in month,day and years. All that put together the code will be:

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


#4

Oh thank you, I tried that but I guess i got it wrong because I did : when changing between mm/dd/yyy and hms


#5

Yah, good thing u got it now


#6

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