Display the current date in a mm/dd/yyyy format in Python

Viewed 20769
from datetime import datetime
current_time = datetime.now()

print "%s-%s-%s" % (current_time.month, current_time.day current_time.year,)
#Will print the current date in a mm/dd/yyyy format.

input()

The code above is meant to print out the current date in a mm/dd/yyyy format in a command prompt. So for example if this actually worked it would open up a command prompt window that printed out; for example the current date as im writing this like this: 8-5-2017

I keep getting this error when trying to run the module that the closing " in "%s-%s-%s" that it's invalid syntax. Is python 3 using something different from this or did I make a mistake?

1 Answers
Related