关于PHP读取时间号码有关问题
程序员文章站
2024-02-12 18:56:28
...
关于PHP读取时间号码问题
上面代码读取的年和号,如201456我想改成2014056增加一位,请问怎么改?
------解决方案--------------------
public function pai3(&$actionNo, &$actionTime, $time=null){
$this->setTimeNo($actionTime, $time);
//echo $actionTime,' ',date('Y-m-d H:i:s', $time);
if($actionTime >= date('Y-m-d H:i:s', $time)){
$actionNo = date('Yz', $time)-6;
}else{
$actionNo = date('Yz', $time)-6;
$actionTime=date('Y-m-d 18:30', $time);
}
}
上面代码读取的年和号,如201456我想改成2014056增加一位,请问怎么改?
------解决方案--------------------
public function pai3(&$actionNo, &$actionTime, $time=null){
$this->setTimeNo($actionTime, $time);
//echo $actionTime,' ',date('Y-m-d H:i:s', $time);
$year = date('Y', $time);
$day = str_pad(date('z',$time),3,'0',STR_PAD_LEFT);
$times = $year.$day;
if($actionTime >= date('Y-m-d H:i:s', $time)){
$actionNo = $times-6;
}else{
$actionNo = $times-6;
$actionTime=date('Y-m-d 18:30', $time);
}
}
相关文章
相关视频