What am I doing wrong?


Hello, I stuck with "Getting the Current Date and Time" lesson. That's What I get after interpreter...

What am I doing wrong ?


Remove the " from the data and time, it does not want a string but the return value of the date time function.

store = datetime.now()


You put "now" as a string, not just datetime.now. Also, you're supposed to print "now".


Excuse me, I never saw in previous lessons "store" ... I don't know how to use it...


It's a variable you can name it anything you want.


copy paste the following code and you should be good to go

from datetime import datetime
print now


Datetime is a value, not a string, so because of that it doesn't need the ''. I know it is weird.


from datetime import datetime

now = datetime.now()
print datetime.now()

Copy and paste the code I just posted above it then should work. When it says print the value of "now" the value of "now" is " datetime.now()".



This does it! Thanks, I've been stuck for a good 5-10 minutes... Feel like such an idiot


@polarstar60 The problem in your code in the now variable. You have quotations marks around the value of the variable "now" making it NOT a function. Remove those quotation marks so now actually represents the function, and print the variable "now" instead of "datetime.now()" as that's what the exercise wants. Make sure you understand why what you did was wrong before moving on.

If you still don't understand or need more help then just ask. Good luck and happy coding !:slight_smile:

-- @chipjumper36731


Copy and paste this, it will solve the issue.

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)