Append date to beginning of exported PDF file

1220
2
Jump to solution
03-15-2012 10:42 AM
DrewSteffens1
New Contributor
Hello all,

I have searched the forums, help files, and python site for an answer to this question but could not find it as it relates to the "ExportToPDF" function.  Up to this point I have been relying on trial and error to get the dateTimeStamp in front of the filename with no success. 

Currently, I have a script that creates and exports maps in a PDF format using the same name as the mxd followed by the dateTimeStamp.  What I would like to have is a filename that shows the date first (YYMMDD) followed by the name of the map document. For example,  120315 Sewer Lines.

How can this be accomplished?  Is there another script format that allows you to change the order of elements in filenames?

Any help or insight is appreciated 🙂

I am using the following script:
dateTimeStamp = time.strftime('%y%m%d') arcpy.mapping.ExportToPDF(mxd,r"S:\GIS Data\Scripts\Temp PDF\Sewer Lines" + dateTimeStamp + ".pdf")
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MathewCoyle
Frequent Contributor
Does this work?

arcpy.mapping.ExportToPDF(mxd,r"S:\GIS Data\Scripts\Temp PDF\\"+dateTimeStamp+"sewerlines.pdf")

View solution in original post

2 Replies
MathewCoyle
Frequent Contributor
Does this work?

arcpy.mapping.ExportToPDF(mxd,r"S:\GIS Data\Scripts\Temp PDF\\"+dateTimeStamp+"sewerlines.pdf")
DrewSteffens1
New Contributor
Works Perfectly! 

Thank you!
0 Kudos