将其四舍五入
为什么这段代码可以工作:
<TD width="10%" ..............
{if ............} PRINT <BR>
{else}
{if $a>=$b} something {$a-$b-86400|date_format:"%d"} days {/if}
{/if}
</TD>
但是这个没有
<TD width="10%" ..............
{if ............} PRINT <BR>
{else}
{if $a>=$b} something {($a-$b)/2|date_format:"%d"} days {/if}
{/if}
</TD>
我只把这个等式$a-$b-86400改为($a-$b)/2,网站不起作用
应该可以了
{if $a>=$b} something {(($a-$b)/2)|ceil|date_format:"%d"} days {/if}
正如评论中提到的,将计算放在括号中,因为小数在时间戳中不应该有效:用|ceil