Help with grand finale


#1

It keep saying my time is not in the correct format, I can't so any errors in the coding, someone help please...driving me crazy

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)

^copy of my code


#2

It is correct and working right.


#3

thank you this works ^^^ !!


#4

now = datetime.now() should be on line 2, otherwise you get an error.


#5

i keep typing this code but it doesn't work!
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)

what is wrong and how should i type this?
:cry:


#6

you missed a comma between now year and now hour?


#7

:roller_coaster:

:clapper: :roller_coaster:


#8

yes yes yes haroon
:roller_coaster:


#9

:grinning: :grin: :joy: :smiley: :couple_with_heart: :couple_with_heart:


#10

don't worry abbas
lolololo


#12

=;lol abbas is a prestige 10 m**f


#14

I have the same problem, my codes are as the followings:-

from datetime import datetime
now = datetime.now()

print '%s/%s/%s' % (now.month, now.day, now.year)
print '%s:%s:%s' % (now.hour, now.minute, now.second)

where did I get it wrong? :frowning: thanks!


#15

Hi,
You need to print the month, day, year, hour, minute and second on a single line like this
print "%s/%s/%s %s:%s:%s" %(now.month, now.day, now.year, now.hour, now.minute, now.second)

Thank You