4
I have a dhEmi tag that has this value 2016-09-09T08:10:52-03:00
To return me a datetime I did the following.
$dtemis = $item->infNFe->ide->dhEmi;
$res = explode("T", $dtemis);
$res1 = explode("-03:00", $res[1]);
$array = array ($res[0],$res1[0]);
$dtemisformat = implode (' ', $array);
$dtemisformat = ''.$dtemisformat.'.000';
The code above returns to me 2016-09-09 08:10:52.000
however the value -03:00 on the line $res1 = explode("-03:00", $res[1]);
various, not always being the same for example: -02:00.
Is there any suggestion to improve the code ?
What is the purpose of this code, just the time?
– rray
The date and time is after that I give an input in the database. So I need to format.
– KevinF