2. getting the current date & time

how to store the value in now variable

Oops, try again. Did you store the result of datetime.now() in the now variable?

plz help me with this error

hello
i also had a error.
your code should look like this :

now = datetime.now()
print now

4 Likes

thanks for the help @gerritventer

hey @gerritventer can you tell me how to get the results from 3:extarxting inforamtion

Hey @abhkr007, sorry I was not with my computer, I will check if I have done that one yet, then I will help you, I’m not sure if I have done that one yet

i have done that one, here is how your code should look like :

now = datetime.now()
print now
print now.year
print now.month
print now.day

by doing this you will get the current year,month,day, the now lets the code display the date,month,day that it currently is.

it is evening here now, i will continue again in the morning,so then i will be able to help if you struggle with other also :slight_smile:

I’m not sure what ‘3:extarxting inforamtion’ is.

the code for 3: extracting information should look like this :
now = datetime.now()
print now
print now.year
print now.month
print now.day

in 3 extracting information, they want you to let the date appear shorter, so then you need to print the conditions they are looking for ( year,month,date) and you use the variable now to get the current year,month,day

eg:
print now.year ( will give you the current year) ect

@abhkr007 try this

from datetime import datetime
now = datetime.now()
print now

Hello!
I used the same code but it shows error.
Plese help me asap.

hello.

can you please send me the error that you are getting?

hi i am new to python coding. so i did your code and its says there is an error. the error say’s "File python, line 3, in NameError: name ‘now’ is not defined