Text Variable Error Type 3: Incorrect Date Format
A client recently wanted to modify the date format used in the footers of her document. So she sent me this to use for the new format: YYYYMMDD.
I pasted this text into the text variable date modification field and resumed editing the document. While I was working, I noticed that the date format ended not in today's date, but in 69. Wait a minute! There are never 69 days in a month!
|DD looks wrong! There are not 69 days in the month|
I thought perhaps this 69 represented some other type of modification data, so I checked the InDesign Help file for what could be represented by DD (as opposed to dd). There was nothing! Out of curiosity, I changed the DD to dd and the date was now correct.
|Correct! This file was modified on the 10th of the month|
The first time this happened was on March 10. The DD format gave me the number 69. Today (March 11) I opened the file and the DD format gave me 70.
After a little thinking, I looked at my calendar and discovered that today is the 70th day in the calendar year. So I opened up a file that had a different modification date and experimented with the DD variable to see what it gave me.
|DD will output the day of the year!|
It turns out the DD is actually a variable not documented in the InDesign help file.
Unlike other variables, which can be typed as either uppercase or lowercase, the date format is case sensitive.
- dd will give you the day of the month.
- DD will give you the day of the year.
If your text variables are giving you trouble, please also check out this post on InDesign Secrets: What to Know Before Using Live Captions and Text Variables.