2. getting the current date & time


#1

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


#2

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

now = datetime.now()
print now


#3

thanks for the help @gerritventer


#4

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


#5

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


#6

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 :slightly_smiling:


#7

I'm not sure what '3:extarxting inforamtion' is.


#8

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


#9

@abhkr007 try this

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


#10

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


#11

hello.

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


#12

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