FreeMarker Current Date Comparison

前端 未结 4 2532

Is it possible to do date comparisons against the current date in a freemarker template without passing the current date into the template?

4条回答
  •  面向向阳花
    2021-02-20 13:46

    Better way to compare two dates in freemarker is to find the difference between two dates.

    <#assign difference = (custom_date?long / 86400000)?round - (.now?long / 86400000)?round />
    

    If the difference is greater than 0, it's a future date, if it equal it is same date, if it less than, it is previous date

提交回复
热议问题