7

I have to calculate a sale end time relative to today,

I have the sale end time variable in this format {%d/%m/%Y %H:%M:%S} e.g.:(31/07/2016 18:27:58).

What I'm trying to do is to show ends: 8 days 06:10:29.
I can't use php code in the template because I'm using smarty 3 and I'm not an expert in smarty.

Matteo Enna
  • 1,285
  • 1
  • 15
  • 36
no_dir_rahou
  • 81
  • 1
  • 7

1 Answers1

5

Change your date1 and date2 values

{assign var="date1" value= $smarty.now}
{assign var="date2" value= $smarty.now+20*24*60*60}

{assign var="dateDiff" value=$date2 - $date1}

{$dateDiff|date_format:'%Y-%m-%d %H:%M:%S'}
sandip
  • 533
  • 9
  • 29