【问题标题】:Watson Conversation: adding one year to current dateWatson 对话:将一年添加到当前日期
【发布时间】:2017-03-09 23:09:35
【问题描述】:

目标:打印当前年份“2017”和下一年“2018”。 我目前可以使用下面打印当前年份,但无法打印下一年。

"Current_Year": "<? now().reformatDateTime('yyyy')  ?>"
"Next_Year": "<? now().reformatDateTime('yyyy+1')  ?>"

【问题讨论】:

    标签: watson-conversation


    【解决方案1】:

    您必须将其转换为整数,然后将其加 1。

     "Next Year":" <?now().reformatDateTime('yyyy').toInt()+1 ?>"
    

    现在您将获得 2018 年的结果。

    【讨论】:

    • 嗯...当我将代码放在这里时,我仍然收到错误消息。错误是说“期望字符串、数字、null、true、false 等,但未定义”“context”:{“Next_Year”: now().reformatDateTime('yyyy').toInt()+1 ?> }
    • 现在可以使用了,谢谢!我忘记了第二部分的引号。
    猜你喜欢
    • 2020-11-11
    • 1970-01-01
    • 2013-03-22
    • 2020-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-30
    • 1970-01-01
    相关资源
    最近更新 更多