May I make in a variable of minute or hours instead of a month
    1. {{assign var="xdate" value="-1 month"|date_format:"%Y-%m-%d"}} I want that on my homepage the list of articles with a delay 30 minutes was output. Thanks all
  • 1 Comment sorted by
  • Have you tried something like this:

    {{ "-1 hour"|camp_date_format:'%Y-%m-%d %H:%M:%S' }}

    According to smarty documentation, everythnig that php's strtotime() function accepts, will be accepted. Some examples in php

    strtotime("now")
    strtotime("10 September 2000")
    strtotime("+1 day")
    strtotime("+1 week")
    strtotime("+1 week 2 days 4 hours 2 seconds")
    strtotime("next Thursday")
    strtotime("last Monday")

    You can test with this kind of values by outputting the values and comparing them to the current time, for example

    <p>Current time: {{ $smarty.now|camp_date_format:'%Y-%m-%d %H:%M:%S' }}, tested value: {{ "-1 hour"|camp_date_format:'%Y-%m-%d %H:%M:%S' }}</p>

    Hope this helps!
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric