I am producing some maps and I want the date on the map to be yesterdays date, as the data on the map relates to yesterdays progress.
I can only find in the dynamic date help section how to show this with today's date, when I want today-1.
Any ideas?
Mark Pratt
Western Geco
Solved! Go to Solution.
Are you using data driven pages? If you are then you can use Wes Miller's code in a display expression for your data driven page layer like so:
def FindLabel ( ): from datetime import date, timedelta return date.strftime(date.today() - timedelta(days=1), '%m/%d/%Y')
Then in your dynamic text element you would use this:
<dyn type="page" property="expression" />
This works for me and should update automatically for all your maps since it uses the current date code.
Luke
Sad to say that they are not data driven pages but separate MXD files.
Well you could still set up data drive pages especially if your maps are all consistent and using an index polygon layer for paneling such as a town boundary polygon. You could also set up a fishnet of your map area to create a panel scheme. But if you already have it up and running with the text element and python script tool you might as well stick with that.
Luke, the code was from Jon Morris
Oops thanks for the correction Wes. Indeed, credit goes to Jon Morris for the code.
Thanks! I didn't know much about text elements, so I've learned something here too 🙂