Re: Date and Time (Pretty)


#1

Hi, I'm able to get an output with the code below.

The output to my code is:
9/22/2016 16:26:7

But, I'm getting the error message :

Oops, try again.
It looks like your printed time is not in the proper format: hh:mm:ss

Code:
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)

Requesting advice.

`


#2

Hello

Only time.
You have too many %s. It only wants the now.hour, now.minute,now.second.


#3

OMG, that did it. I was over thinking it. Thank you.


#4

That is good news.

Remember -

All the best further & as you said, do not over think it.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.