标签:
把字符类型转换成时间类型的,先用foreach遍历出来时间,在通过时间函数转换成时间格式;
例子:
<?php
echo "<pre>";
$lsrfield = array(
0 =>array(
‘lsrtime‘ => ‘1410710400‘,
‘lsrqian‘ => ‘完善个人资料奖励积分‘,
),
1 =>array(
‘lsrtime‘ => ‘2410710400‘,
‘lsrqian‘ => ‘完善个人资料奖励积分‘,
),
2 =>array(
‘lsrtime‘ => ‘3410710400‘,
‘lsrqian‘ => ‘完善个人资料奖励积分‘,
)
);
print_r($lsrfield);
foreach($lsrfield as $k => $val){
$lsrfield[$k][‘lsrtime‘] = date(‘Y-m-d H:i:s‘,$val[‘lsrtime‘]);
}
print_r($lsrfield);
?>
通过转换出的输出的结果是:
Array ( [0] => Array ( [lsrtime] => 2014-09-14 16:00:00 [lsrqian] => 完善个人资料奖励积分 ) [1] => Array ( [lsrtime] => 1910-04-17 11:18:24 [lsrqian] => 完善个人资料奖励积分 ) [2] => Array ( [lsrtime] => 1941-12-24 13:05:04 [lsrqian] => 完善个人资料奖励积分 ) )
通过上面的例子,我们可以举一反三,可以用同样的方法可转化打其他的字符类型;
标签:
原文地址:http://www.cnblogs.com/costa92/p/4244273.html