I'm trying to create a dynamic map title in ArcMap that updates based on current day + 2 days. For example, if I run the code on the 20th of a given month, the title should update to show the 22nd.
I've arrived at two independent, but partial solutions: the first works in pure Python not integrated with ArcMap and the second works using Dynamic Text (but only for the current date). I'm not partial to one method over another, but am not familiar enough with either to arrive at a satisfactory solution. Is anyone aware of a way to use either of these methods to solve the issue?
Partial Solution #1 - Python code
from datetime import date, timedelta import calendar publication_date = date.today() + timedelta(days=2) publication_day_of_week = calendar.day_name[publication_date.weekday()] #Title format example: #"Forecast for Thursday March 17" print "Forecast for " + publication_day_of_week + " " + publication_date.strftime("%B %d")
Running this script as of today (March 17, 2016) correctly yields the text "Forecast for Saturday March 19"
Partial Solution #2 - ArcMap Dynamic Text tags
<dyn type="document" property="title"/> <dyn type="date" format="dddd MMMM d"/">
The title property above represents the text "Forecast for" which is followed by the formatted date.
However, the output is "Forecast for Thursday March 17"-- the current date. As far as I can tell, dynamic text can only use the current date, time, etc., and cannot be used to forecast 2 days out from the current date.
I've already reviewed the following but can't seem to see a complete solution: