【问题标题】:How to configure a custom date format for ActiveWeb templates如何为 ActiveWeb 模板配置自定义日期格式
【发布时间】:2018-09-21 13:23:42
【问题描述】:

views docs有数字格式配置示例:

public class FreeMarkerConfig extends AbstractFreeMarkerConfig {
    @Override
    public void init() {
        //this is to override a strange FreeMarker default processing of numbers
        getConfiguration().setNumberFormat("0.##");
     }
}

以下代码中自定义日期、时间格式的正确语法是什么:

getConfiguration().setDateFormat("what comes here ?????");

谢谢。

【问题讨论】:

    标签: javalite activeweb


    【解决方案1】:

    getConfiguration() 方法只返回一个freemarker.template.Configuration 的实例,它使您可以直接访问以任何您想要的方式配置 FreeMarker。请参阅FreeMarker Configuration 文档以了解可能的情况。

    【讨论】:

    • 酷,谢谢!我没有找到他们的 API 文档。现在我知道它藏在哪里了 :)
    • 是的,更准确地说是here :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-17
    • 1970-01-01
    • 1970-01-01
    • 2015-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多