Is there a way to display previous and current year with dynamic text?

If so, what is the formatting?

I'm using ArcMap 10.0

  • 1
    Software + version? – mkennedy Jun 19 '13 at 21:43

Adding the current year is easy - the following goes into the text element:

<dyn type="date" format="yyyy"/>

However, I don't know a way to use just dynamic text to do last year. For that I would use ArcPy to update a "pseudo dynamic" text element which may or may not be applicable to what you are trying to do.

This ArcGIS Discussion Forum posting indicates that I am right about not being able to do maths on dynamic text and that discussion has been repeated on this site in Doing Math calculations within ArcMap Dynamic Text? with the same conclusion.

Some time ago I released an eLearning video on Using Pseudo-dynamic Text in ArcPy Map Automation. It is not free but if you do want to pursue that as option, and need a quick intro to the coding pattern involved, then it is only a few dollars to purchase.

The coding pattern is to use Python to set a variable to the calculated date, and then to have a recognizable string in your static text element called perhaps CalcDateVal, that ArcPy searches for and replaces with the contents of your variable.

Disclaimer: I am the author and presenter of the eLearning video tutorial mentioned above

| improve this answer | |

Possible workaround:

  1. Instead of text box create small dataframe with say 1 point.
  2. Label point using Python parser:

    str( datetime.date.today() + datetime.timedelta(days=2))

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.