Select to view content in your preferred language

Python Date Stamping

5340
13
Jump to solution
10-20-2014 08:03 AM
StephenEldridge
Deactivated User


Anyone know how to make python put a date stamp on a filename when creating a feature?

Thanks,

Steve

0 Kudos
13 Replies
BrandonKeinath1
Deactivated User

Understood.  Try this

import datetime

currentdate = datetime.date.today()

nohyphendate = currentdate.strftime(%Y%m%d)

print "output_" + nohyphendate

I had an error in my previous reply.  If you use a %b you get the month abbreviation.  %m gets you the integer of the month.  Does that fix your error?

Thanks,


Brandon

StephenEldridge
Deactivated User

Here is what I used and it worked:

Import datetime

currentdate = datetime.date.today().strftime("%Y""%m""%d")

Thanks again,

Steve

StephenEldridge
Deactivated User

Figured it out. Thanks for your help

0 Kudos
BrandonKeinath1
Deactivated User

You're welcome.  Glad you were able to make it work.

0 Kudos