Leveraging from an old forum thread, and StackOverflow example, one method to do this is to prepend a zero to the current date, then extract only the last two digits from the result. So, if today’s date is the 4th, the result is “04” which is only two digits. If today’s date is the 14th, the result is “014” and the last two digits of course are “14”.
Here is the expression in Axure:
- (Note that .getDate() returns the numeric day of the month, but .getDay() returns the numeric day of the week, starting with Sunday = 0, Monday = 1, etc.)
Another method, which I prefer for elegance and reliability, is to use the .toLocaleDateString() function with a european country as a parameter. It turns out this will/should show two digits per field with leading zeros by default (but there are options to force this formatting; see the StackOverflow link above for details.)
Here is the expression in Auxre, (using “french-France” as an example locale/country):
For today’s date of July 22, 2021 this would show “22/07/2021”
If you want to show dots instead of slashes, you can append the .replace() function like so
…which would show “22.07.2021”