I have an array just like this:
Array
(
[0] => Array
(
[NO] => 1
[NO_RINCIAN] => 70
[TANGGAL_PENARIKAN] => 23-DEC-18
)
[1] => Array
(
[NO] => 2
[NO_RINCIAN] => 90
[TANGGAL_PENARIKAN] => 23-Nov-18
)
)
What I want to do is to convert TANGGAL_PENARIKAN from date to timestamp but in a whole array.
My expected array:
Array
(
[0] => Array
(
[NO] => 1
[NO_RINCIAN] => 70
[TANGGAL_PENARIKAN] => 1545551313
)
[1] => Array
(
[NO] => 2
[NO_RINCIAN] => 90
[TANGGAL_PENARIKAN] => 1542959313
)
)
I've tried converting TANGGAL_PENARIKAN inside the array, but I didn't know how to combine to be an array again after it.
public function getAllData()
{
$data = $this->model_app->getRincian();
foreach ($data as $key => $value) {
for ($i=0; $i <= count($value); $i++) {
$key = $value['TANGGAL_PENARIKAN'];
}
$key = DateTime::createFromFormat("j-M-y", $key);
print_r(json_encode($key->getTimestamp()));
}
}
print_r(json_encode($key->getTimestamp()));
Last code above still return :
15455513131542959313
Any well thought to advise will be appreciated.
Thanks.