I var_dumped an array that shows these elements (there are 266, but I am showing you two).
array(266) {
[1]=>
array(5) {
["date_created"]=>
string(10) "1381816800"
["project_number"]=>
string(5) "02783"
["name"]=>
string(9) "sdfsdfdfd"
["description"]=>
string(13) "dsfsfdsfdssdf"
["manager"]=>
string(11) "Kevin Allen"
}
[21]=>
array(5) {
["date_created"]=>
string(10) "1381816800"
["project_number"]=>
string(5) "02783"
["name"]=>
string(9) "sdfsdfdfd"
["description"]=>
string(13) "dsfsfdsfdssdf"
["manager"]=>
string(16) "Carter Hilkewich"
}
}
I needed to convert the date in this array too: m-d-Y so I wrote:
private function dateConverter($array){
foreach($array as $key=>$value){
if(isset($value['date_created'])){
$value['date_created'] = date("m-d-Y", strtotime($value['date_created']));
}
}
return $array;
}
Which you pass the array into, walks through, converts the date and returns the array. simple. 'Cept what it's returning is the exact same array. So I am wondering do I need to save the "new" array into a separate array? I have a similar function that does this with objects and I never had to save a"new" object.
thoughts?
strtotime()is unnecessary since the time is already a timestamp.