1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Calculation in a template

Discussion in 'XenForo Questions and Support' started by bart, Apr 6, 2013.

  1. bart

    bart Active Member

    I need to make a calculation in a template. I want to know how many hours ago the lastpost was written.

    In a thread-list-item I have: {$thread.last_post_date}. So I would like to do something like this for every thread-list-item:

    is that possible?
  2. Chris D

    Chris D XenForo Developer Staff Member

    I haven't tested this... but it should work:

    {xen:number {xen:calc "({$serverTime} - {$thread.last_post_date}) / 3600"}}
  3. bart

    bart Active Member

    Wow, it does!!!


Share This Page