【问题标题】:XForms: set default date in bindingXForms:在绑定中设置默认日期
【发布时间】:2010-06-07 17:06:59
【问题描述】:

我是 Xforms 的新手,需要帮助设置节点集绑定中的默认日期。我需要将默认日期设置为当前日期 + 30 天。我该怎么做?

【问题讨论】:

    标签: xforms


    【解决方案1】:

    如果您希望结果为xs:dateTime,则以下方法可以解决问题:

    current-dateTime() + xs:dayTimeDuration('P30D')
    

    【讨论】:

    • 我仍然需要将日期设为当前日期 + 30 天。并随时间显示。您的建议仅显示 current-dateTime() + 时间。
    • @Purni,看来我误解了您要查找的内容。我的建议显示当前时间 + 30 天。你在找什么?
    • @Alessandro,我的 xs:dateTime 类型的 xform 上有一个日期时间选择器。在绑定中,我需要将此字段的默认值设置为当前日期 + 30 天。 days-to-date(days-from-date(local-date()) + 30) 执行此操作。但问题是它只设置日期而不是时间。我需要它在 ISO dateTime 中设置 dateTime。格式。
    • @Purni,好的,但不使用current-dateTime() + xs:dayTimeDuration('P30D') 初始化节点吗?它将以 ISO dateTime 格式将当前日期时间 + 30 天放入节点中。
    • @Alessandro - 我昨天试过了,但出错了。我想我有一个错字。我刚才试过了,完全有效!谢谢!
    【解决方案2】:

    想通了。在绑定中,我将日期的默认设置为days-to-date(days-from-date(local-date()) + 30)。但这并没有设定时间。我的字段是 xs:datetime 类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-12
      • 1970-01-01
      • 2016-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多