time.strftime("%d/%m/%Y")
I was googling how to do something similar and this little discussion eventually lead me to my solution.
It can be done by placing a Calculate Value Tool in your model and setting its expression to:
time.strftime("%Y%m%d")
The output value will be a date or time in the format you specify between the "s. This link has a nice table with helpful explanations about the different date and time formatting options and possible associated limitations or restrictions: 8.1. datetime - Basic date and time types - Python v2.7.8 documentation.
My example has the particular format(%Y%m%d) such that if the model were run on June 8, 2001, the output value from the tool would be the string '20010608'.
You can then rename the output value(green bubble) to ANYTHING and then elsewhere in your model you can reference that value by inserting %ANYTHING% into filenames or location dialogues throughout the rest of the model, just like other in-line variables.
I hope this helps you out, 3½ years late, or more likely, somebody else with the same question.
Thanks for posting Ryan Stillman - your late reply helped me figure this out!
Thank you for posting this - it worked perfectly.
Helped me too, thanks for posting!
The Calculate Value tool really makes Model Builder a lot more useful -- and a little Python knowledge goes a long way with that thing!
Works great! Thanks for the post.
Thank you!!
Worked for me also, thanks mate!