Different Date Format

1

Sirs, I have the following code:

            $funcionario_blocodcon_novo = array();
            for($i=0;$i<count($funcionario_blocodcon['localtrabalho']);$i++){
                foreach($funcionario_blocodcon as $key=>$val){


                    if($funcionario_blocodcon['localtrabalhodata'][$i]==""){ $localtrabalhodata = "00/00/0000"; } else { $localtrabalhodata = $funcionario_blocodcon['localtrabalhodata'][$i]; }
                    $localtrabalhodata = date("Y-m-d", strtotime($localtrabalhodata));
                    $funcionario_blocodcon_novo[$i]['localtrabalhodata'] = $localtrabalhodata;

                    if($funcionario_blocodcon['datademissao'][$i]==""){ $datademissao = "00/00/0000"; } else { $datademissao = $funcionario_blocodcon['datademissao'][$i]; }
                    $datademissao = date("Y-m-d", strtotime($datademissao));
                    $funcionario_blocodcon_novo[$i]['datademissao'] = $datademissao;

                    $funcionario_blocodcon_novo[$i][$key]= $funcionario_blocodcon[$key][$i];
                    $funcionario_blocodcon_novo[$i]['idFuncionario'] = $ultimo_id;
                }
            }

In it, I need to format dates that come from date fields ... But the first works normal and the second does not.

Results:

Array
(
    [0] => Array
        (
            [localtrabalhodata] => 2015-12-07
            [datademissao] => 01/02/2015
            [localtrabalho] => 1
            [idFuncionario] => 102
            [segundaasextadas] => 08:00
            [segundaasextaas] => 10:00
            [sabadodas] => 18:00
            [sabadoas] => 00:00
        )

    [1] => Array
        (
            [localtrabalhodata] => 2015-06-07
            [datademissao] => 01/05/2015
            [localtrabalho] => 13
            [idFuncionario] => 102
            [segundaasextadas] => 08:22
            [segundaasextaas] => 11:02
            [sabadodas] => 01:22
            [sabadoas] => 02:33
        )

)

What's wrong? Can you do it any other way? Thanks!

    
asked by anonymous 02.07.2015 / 15:27

0 answers