Questions with Dates less than 12/31/69 in PHP

Asked

Viewed 74 times

1

Galley,

I’m having a problem turning database dates to be displayed on screen.

In my code I do the following.

$objReturn['DADOS'][$key]['DATA_NASCIMENTO'] = date('d/m/y', strtotime($value[DATA_NASCIMENTO]));

But what appears on my screen is

inserir a descrição da imagem aqui

And by returning the value as follows

$objReturn['DADOS'][$key]['DATA_NASCIMENTO'] = $value[DATA_NASCIMENTO];

The result on screen is this

inserir a descrição da imagem aqui

That is to say in the bank, the information is saved correctly.

I think my problem is the way I format this date in PHP.

Does anyone have any suggestions?

1 answer

2


Depending on the PHP version you use:

$date = date_create($value[DATA_NASCIMENTO]);
$objReturn['DADOS'][$key]['DATA_NASCIMENTO'] = date_format($date, 'd/m/y');

See if it returns correctly.

  • Thanks! It did work. Thanks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.