Getting the Current Date and Time


#1



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


from datetime import datetime
now=2017-06-29 15:34:05.618208
print datetime.now()

error

File "python", line 2
now=2017-06-29 15:34:05.618208
^
SyntaxError: invalid syntax


Replace this line with your code.


#2

1.) Create a variable called now and store 
the result of datetime.now() in it.
2.) Then, print the value of now.

So as you can see from the instructions, and as you have done, you have created a variable now. Except, you are supposed to equal now to not the time but the result of datetime.now. Yes, the result of datetime.now will be an exact time. However, your not equaling now to that directly, you are going to equal now to datetime.now() (as in the instructions). This way when you print the value of now (as in the second step of the instructions) when you print now, datetime.now() will be run through now to give you the time.


#3

Thanks, mate! Its appreciated.


#4

No problem man! Glad to have helped! :thumbsup:


#5

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