Inserting Current Date into Filename via Modelbuilder

23104
17
02-04-2011 05:46 AM
JeffPickles
New Contributor III
Is there a way to programmatically export a shapefile or feature class from Modelbuilder that has the current date in its filename?
17 Replies
ShariForbes
New Contributor III

Helped me too! Never too late. 

0 Kudos
MichelleWalker
New Contributor II

thanks so much - this worked great and really helped me

0 Kudos
curtvprice
MVP Esteemed Contributor
0 Kudos
DanSadler1
New Contributor II

Almost a decade after you posted, and your answer still works - even in ArcGIS Pro! The (possible?) difference from ArcMap is you access Calculate Value in Pro via its own item in the ModelBuilder ribbon under Utilities and set the data type as string.

I hope this helps other ArcGIS Pro folks who surf here as this thread was the top search engine result. 

0 Kudos
WilliamJackson4
New Contributor II

Odd, the example doesn't seem to work for me. I'm running 10.3.1. If I run in a python script it works fine but not so much in Model Builder where the variable is assigned a "1". Any suggestions?

0 Kudos
by Anonymous User
Not applicable

William, I was having the same issue but then I connected the output date (green bubble) as a precondition variable to the tools (yellow bubble) that I ran and it worked for me!

LindsayRaabe_FPCWA
Occasional Contributor III

I seem to be having similar issues. I was getting the "1" output but now I get the date but also keep getting errors about incorrect naming. Can anyone tell me what name is wrong? The original demo tool provided further up has the same issue!

Lindsay Raabe
GIS Officer
Forest Products Commission WA
0 Kudos
curtvprice
MVP Esteemed Contributor