将Y-m-d转换为Y年m月d日
原创
©著作权归作者所有:来自51CTO博客作者qq58fdc80357c56的原创作品,请联系作者获取转载授权,否则将追究法律责任
$time = date("Y-m-d", $time);
$var=explode(' ',$time);
$var1=$var[0];
$time=explode('-',$var1);
if($time[1]<10){
$time[1] = str_replace("0", "", $time[1]);
}else{
$time[1]=$time[1];
}
if($time[2]<10){
$time[2] = str_replace("0", "", $time[2]);
}else{
$time[2]=$time[2];
}
$new_time = $time[0]."年".$time[1]."月".$time[2]."日";
简单封装下
/**
* 拼装年月日
*/
public function rn_date($time){
$var=explode(' ',$time);
$var1=$var[0];
$time=explode('-',$var1);
if($time[1]<10){
$time[1] = str_replace("0", "", $time[1]);
}else{
$time[1]=$time[1];
}
if($time[2]<10){
$time[2] = str_replace("0", "", $time[2]);
}else{
$time[2]=$time[2];
}
$new_time = $time[1]."月".$time[2]."日";
return $new_time;
}
根据大佬评论 耻辱删帖
echo date('Y年m月d日',time());