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?
Asked
Active
Viewed 73 times
1
-
1FYI: There is an prescribed XML date & time format. The author of this XML file should be using that. http://stackoverflow.com/questions/254753/ – Moby Disk Jul 17 '14 at 17:57
1 Answers
2
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, ' ')
)

dirkk
- 6,160
- 5
- 33
- 51