DateTime


#1




DateTime Problems In Python

So I'm doing the Date And Time course on python , But i really need help , I'm stuck , It's on the second activity of the course.


This is what i need to do

  1. Create a variable called now and store the result of datetime.now() in it.

  2. Then, print the value of now.


This might seem like an easy solve to a question , But i haven't coded in a while so i kind of forgot
some thing's


So yeah , That's my problem , I've also made this topic using HTML so i don't forget :smile:




#2

Hey you are better off googling for how to do these things, google is a huge help when writing code. And, you know, less typing for those answering questions. But it's better for you as well in the long run.


#3

I do not know what to do, like you:(. Someone can help us?


#4

hello @absoluteprogrammer13

you can use .year , .month and .day on your var

example:

from datetime import datetime
maintenant = datetime.now()

print '%s/%s/%s' % (maintenant.month, maintenant.day, maintenant.year)

#5

Well,it's worked.But I don't know why.
you can try this.

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


#6

@aureolebigben Sorry for the late reply , But it's worked , Thanks!


#7

@coreslayer11909 Sorry for he late reply , But it also works! Thanks!