mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add now() jinja2 global func for getting the date/time (#43792)
* Add now() jinja2 global func for getting the date/time * Docs and changelog * now isn't a lookup, it doesn't need disabled
This commit is contained in:
parent
3d5d0d355f
commit
3a4d476512
3 changed files with 34 additions and 0 deletions
|
@ -18,6 +18,24 @@ Please note that all templating happens on the Ansible controller before the tas
|
|||
playbooks_lookups
|
||||
playbooks_python_version
|
||||
|
||||
.. _templating_now:
|
||||
|
||||
Get the current time
|
||||
````````````````````
|
||||
|
||||
.. versionadded:: 2.8
|
||||
|
||||
The ``now()`` Jinja2 function, allows you to retrieve python datetime object or a string representation for the current time.
|
||||
|
||||
The ``now()`` function supports 2 arguments:
|
||||
|
||||
utc
|
||||
Specify ``True`` to get the current time in UTC. Defaults to ``False``
|
||||
|
||||
fmt
|
||||
Accepts a `strftime <https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior>`_ string that will be used
|
||||
to return a formatted date time string
|
||||
|
||||
|
||||
.. seealso::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue