播放2框架添加日期到目前为止

时间:2022-08-25 18:30:36

I got a simple Play template with the following structure.

我得到了一个简单的Play模板,其结构如下。

@(order : Order){ <html><p> My Date @order.orderDate.format("dd'.'MM'.'yyyy")</p></html> }

@(订单:订单){

我的约会@order.orderDate.format(“dd'。'MM'。'yyyy”) }

I would like to add 2 Days to the printed Date direct in the template.

我想在模板中直接添加2天打印日期。

Thanks for help

感谢帮助

1 个解决方案

#1


Got it

            @{
            import java.util.Calendar

            val newOrderDate = Calendar.getInstance()
            newOrderDate.setTime(order.orderDate)

            newOrderDate.add(Calendar.DAY_OF_MONTH, 2)

            newOrderDate.getTime().format("dd'.'MM'.'yyyy")
        }

#1


Got it

            @{
            import java.util.Calendar

            val newOrderDate = Calendar.getInstance()
            newOrderDate.setTime(order.orderDate)

            newOrderDate.add(Calendar.DAY_OF_MONTH, 2)

            newOrderDate.getTime().format("dd'.'MM'.'yyyy")
        }