Return JSON with date and time

1

I have a problem to return json with date and time the code is as follows:

<?php
$sql = "SELECT CRED_NUMERO, MOV_DATAHORA FROM APOIO.LOG_CREDENCIAL_APOIO A WHERE A.CRED_NUMERO = 10734568 AND TRUNC(MOV_DATAHORA) = TRUNC(SYSDATE)";
$conn = oci_connect('xxx', 'xxx', '127.0.0.1/DBUAM');
$dados = oci_parse($conn, $sql);
oci_execute($dados, OCI_DEFAULT);

$linhas = array();
while($l = oci_fetch_assoc($dados)){
    $linhas[] = $l;
}

$json = (json_encode($linhas));
echo $json;
?>

The result of json is this:

  

  • p>
  • The table looks like this:

    If you notice the resulting JSON shows only the DATA being that what matters most to me is time. How to format?

        
    asked by anonymous 26.08.2015 / 16:13

    1 answer

    4

    use

    $sql ="SELECT CRED_NUMERO, TO_CHAR(MOV_DATAHORA,'HH24:MI:SS') MOV_DATAHORA FROM APOIO.LOG_CREDENCIAL_APOIO A WHERE A.CRED_NUMERO = 10734568 AND TRUNC(MOV_DATAHORA) = TRUNC(SYSDATE)"
    

    If you want to retrieve only the time or replace to

    TO_CHAR(MOV_DATAHORA,'DD/MM/YYYY HH24:MI:SS')
    

    To get the date and time. The default in PHP settings should be in another format

        
    26.08.2015 / 21:18