aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/twig/twig/doc/functions/date.rst
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twig/twig/doc/functions/date.rst')
-rw-r--r--vendor/twig/twig/doc/functions/date.rst52
1 files changed, 0 insertions, 52 deletions
diff --git a/vendor/twig/twig/doc/functions/date.rst b/vendor/twig/twig/doc/functions/date.rst
deleted file mode 100644
index f1c94819..00000000
--- a/vendor/twig/twig/doc/functions/date.rst
+++ /dev/null
@@ -1,52 +0,0 @@
1``date``
2========
3
4.. versionadded:: 1.6
5 The date function has been added in Twig 1.6.
6
7.. versionadded:: 1.6.1
8 The default timezone support has been added in Twig 1.6.1.
9
10Converts an argument to a date to allow date comparison:
11
12.. code-block:: jinja
13
14 {% if date(user.created_at) < date('-2days') %}
15 {# do something #}
16 {% endif %}
17
18The argument must be in a format supported by the `date`_ function.
19
20You can pass a timezone as the second argument:
21
22.. code-block:: jinja
23
24 {% if date(user.created_at) < date('-2days', 'Europe/Paris') %}
25 {# do something #}
26 {% endif %}
27
28If no argument is passed, the function returns the current date:
29
30.. code-block:: jinja
31
32 {% if date(user.created_at) < date() %}
33 {# always! #}
34 {% endif %}
35
36.. note::
37
38 You can set the default timezone globally by calling ``setTimezone()`` on
39 the ``core`` extension instance:
40
41 .. code-block:: php
42
43 $twig = new Twig_Environment($loader);
44 $twig->getExtension('core')->setTimezone('Europe/Paris');
45
46Arguments
47---------
48
49 * ``date``: The date
50 * ``timezone``: The timezone
51
52.. _`date`: http://www.php.net/date