4
I have the following code:
$respostaXML = "<data-hora>2015-11-10T11:33:41.086-02:00</data-hora>";
$posTag = strpos($respostaXML,"<data-hora>");
$comprimento = (strpos($respostaXML,"</data-hora>") - strpos($respostaXML,"<data-hora>"));
$respDataHora = substr($respostaXML,$posTag,$comprimento);
$respData = substr($respDataHora,9,2) . "/" . substr($respDataHora,6,2) . "/" . substr($respDataHora,1,4);
$respHora = substr($respDataHora,12,8);
My intention is that in the answer I get "11/10/2015" and in the answer "11:33:33". It happens that the result is being this:
respDataHora = 2015-11-10T11:33:41.086-02:00
respData = a>/ho/data
respHora = 015-11-1
The respDataHora is OK, already the respData gave this bizarre result (excerpts from the NAME of the previous variable) and the respHora must have given these numbers for the same reason.
The same code, with different syntax and functions, of course, works perfectly in classic ASP. What’s going on there?
The problem was that I was pulling the String in respDataHora with tag and everything, because they are tags they do not appear in the page view. The correct code must have a "+11" at the end of the posTag and "-11" at the end of the variable length
– Daniel Tietz