Convert date type DD-MM-YYYY to DD-MM-YY on AS400 iSeries

0

Good morning.

Realizing a date format in As400 I realize that with DAY - MONTH - YEAR, doing the order that you want works but it will always throw me 01-09-1995 but what I want you to show me now is 01-09- 92 Has anyone done a formatting to make it that way ?, I appreciate the help. I show an example that I am doing with AS400 and php.

$campos.="DAY(".$campo_nombre.")|| '-'|| MONTH(".$campo_nombre.") || '-' || YEAR(".$campo_nombre.") AS FEC_".$id_campo.",";
    
asked by JuanD 18.01.2017 в 15:07
source

1 answer

0

You could try the following in PHP:

$campos.="DAY(".$campo_nombre.")|| '-'|| MONTH(".$campo_nombre.") || '-' || YEAR(".$campo_nombre.") AS FEC_".$id_campo.","; // Obtenes la fecha
$fecha = DateTime::createFromFormat('d-m-Y', campos); // Obtenes una fecha a partir del formato especificado
echo $fecha->format('d-m-y'); // Lo imprimis con el nuevo formato

I hope I served you. Anything warn us.

Greetings!

    
answered by 18.01.2017 / 17:44
source