Create a new script in the plugins
directory:
plugins
+------ build_date.py
Add a method that returns today's date:
from datetime import datetime
def now(data: dict, args: dict) -> str:
if 'format' not in args:
args['format'] = '%B %d, %Y at %H:%M'
return datetime.now().strftime(args['format'])
Call the plugin method in any template file:
<p>
Last refresh: \{: build_date.now :\}
</p>
Update the default date format with an option:
<p>
Last refresh: \{: build_date.now format:"%m/%d/%Y %H:%M" :\}
</p>