0

我们有一个特殊的功能,它应该将日期和时间值转换为用户的本地时区。我了解到在 xfdl 版本 8 中已经提供了 adjust-dateTime-to-timezone() 日期函数,因此我尝试使用它。

但是,我不断收到错误 Tue Jul 17 21:49:28 2012 0 Viewer : xforms-compute-exception:adjust-dateTime-to-timezone(../utcDT)。

这是实际的源代码。

<XFDL xmlns:custom="http://www.ibm.com/xmlns/prod/XFDL/Custom" xmlns:designer="http://www.ibm.com/xmlns/prod/workplace/forms/designer/2.6" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xfdl="http://www.ibm.com/xmlns/prod/XFDL/8.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns="http://www.ibm.com/xmlns/prod/XFDL/8.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<globalpage sid="global">
    <global sid="global">
        <designer:date>20120717</designer:date>
        <formid>
            <title/>
            <serialnumber></serialnumber>
            <version>1.0.0</version>
        </formid>
        <pageloading>
            <ondemand>enable</ondemand>
        </pageloading>
        <transmitformat>application/vnd.xfdl;content-encoding=base64-gzip</transmitformat>
        <saveformat>application/vnd.xfdl;content-encoding=base64-gzip</saveformat>
        <xformsmodels>
            <xforms:model>
                <xforms:instance id="formData" xmlns="">
                    <root>
                        <utcDT>2011-09-01T23:00:01Z</utcDT>
                        <!-- UTC dateTime -->
                        <localDT>2011-09-01T23:00:01Z</localDT>
                        <!-- local dateTime with the timezone (accounting for daylight saving correction) -->
                    </root>
                </xforms:instance>
                <xforms:bind nodeset="utcDT | localDT" type="xforms:dataTime"/>
                <xforms:bind calculate="adjust-dateTime-to-timezone(../utcDT)" nodeset="localDT"/>
            </xforms:model>
        </xformsmodels>
        <history>
            <editors>
                <editor minversion="3.5.1" version="4.0.0">IBM Forms Designer</editor>
            </editors>
        </history>
    </global>
</globalpage>
<page sid="PAGE1">
    <global sid="global">
        <label>PAGE1</label>
    </global>
    <label sid="l2">
                <xforms:output ref="localDT">
                    <xforms:label>Local dateTime = </xforms:label>
                </xforms:output>
    </label>
    <spacer sid="vfd_spacer">
        <itemlocation>
            <x>960</x>
            <y>1260</y>
            <width>1</width>
            <height>1</height>
        </itemlocation>
    </spacer>
</page>

非常感谢您的帮助!先感谢您!

从凯利

4

1 回答 1

1

的第一个参数adjust-dateTime-to-timezonemust 是 anxs:dateTime并且您在这里传递给它一个元素。因此,您需要编写:

adjust-dateTime-to-timezone(xs:dateTime(../utcDT))
于 2012-07-20T00:45:17.003 回答