Since TD 5.1 we have this function __SalXMLDeserializeDateTime (from SalXMLws.apl) which is used to convert a XML DateTime string to TD DateTime value in webservices.
In all TD versions, the TD implementation is incorrect. Including the latest TD 6.3.
First a list of possible XML DateTime example values:
A) "2016-11-28T23:59:49"
B) "2016-11-28T23:59:49Z"
C) "2016-11-28T23:59:49-06:00"
D) "2016-11-28T23:59:49+06:00"
In all cases, the datetime in TD should be:
2016-11-28 23:59:49
Right now, only B) and D) are correctly converted.
Examples A) and C) will result in:
2016-11-27 22.58.59
Looking at the implementation, the cause is clear.
The line
Set sXMLParsed = '1900-01-01-' || sXMLParsed
should be done AFTER the checks for Z, + and - and not before.
Right now, the '1900-01-01-' part of the string will be used to check if it contains a - sign. This is always the case and it results in an invalid datetime.
Secondly:
Even the corrected functionality is incorrect as it just strips Z, + and - signs from the DateTime. There is a reason why these characters are there.
When TD converts the XML value it should REALLY convert to the timezone and daysavings of the system it is running on.
See sample (saved in TD51 format). Select the XML value in the combo and execute. See the datetime result in the field.
TD-22922: [All TD versions] SalXMLDeserializeDateTime conversion incorrect
-
- Founder/Site Admin
- Posts: 3473
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
TD-22922: [All TD versions] SalXMLDeserializeDateTime conversion incorrect
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: TD-22922: [All TD versions] SalXMLDeserializeDateTime conversion incorrect
Just tried it on TD7.0 UPD1 and it is working.
All the dates are the same.
JFYI
All the dates are the same.
JFYI
Igor Ivanovic
Who is online
Users browsing this forum: [Ccbot] and 0 guests