您好我有这个代码来源
<from expression="concat(substring(xp20:current-dateTime(),1,(string-length(xp20:current-dateTime())-6)),'Z')"/>
这很好,并返回这样的日期:
2014-04-29T03:00:22Z
但是我需要在10秒内添加日期,我试试这个:
<from expression="concat(substring(xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT10S'),1,(string-length(xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT10S'))-6)),'Z')"/>
并且仅返回:
Z
这适用于Oracle BPEL 10G
有了这个
<from expression="concat(substring(string(xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT10S')),1,(string-length(string(xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT10S')))-6)),'Z')"/>
返回
Z
但如果我只用PT1M改变PT10S就行了
<from expression="concat(substring(string(xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT1M')),1,(string-length(string(xp20:add-dayTimeDuration-to-dateTime(xp20:current-dateTime(), 'PT1M')))-6)),'Z')"/>
返回
2014-04-30T13:58:57Z
也许add-dayTimeDuration-to-dateTime会忽略秒数,而PT1M10S只会添加1M
答案 0 :(得分:0)
我无法对Oracle进行测试,所以我不确定你的XPath中发生了什么,它基本上看起来是正确的。根据文档,Oracle看起来支持format-dateTime
。然后你可以编写更简单,更清晰的
xp20:format-dateTime(xp20:add-dayTimeDuration-to-dateTime(current-dateTime(), "PT10S"), "[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]Z")
获取您想要实现的正确格式