Wednesday, July 16, 2014

How to get today's date in MMDDYYYY format

Code
import time                           #1
print time.strftime("%m%d%Y")         #2


How this works - Line by Line

import time                           #1

Imports the time module which is standard

print time.strftime("%m%d%Y")         #2

Prints the date in "MMDDYYYY" format. Note the lower case m and d and upper case Y.

No comments:

Post a Comment