Reputation: 2019
How can I convert Strings in this format dd/mm/yyyy hh:mm:ss
into this format yyyy/mm/dd hh:mm:ss
using XPAth 1.0?
Upvotes: 1
Views: 84
Reputation: 6218
Unfortunately, XPath 1.0 does not even support regular expression. Hence, I think you are stuck with using substring functions.
The following is not very elegeant, but it should work ($date
being your input string). It split the different parts and reconstruct the string afterwards.
concat(
substring-after(substring-after(substring-before($date, ' '), '/'), '/'),
'/',
substring-before(substring-after(substring-before($date, ' '), '/'), '/'),
'/',
substring-before(substring-before($date, ' '), '/'),
' ',
substring-after($date, ' ')
)
Upvotes: 2