Home  >  Article  >  Backend Development  >  关于PHP读取时间号码有关问题

关于PHP读取时间号码有关问题

WBOY
WBOYOriginal
2016-06-13 11:47:00893browse

关于PHP读取时间号码问题

public function pai3(&$actionNo, &$actionTime, $time=null){<br />		$this->setTimeNo($actionTime, $time);<br />		//echo $actionTime,' ',date('Y-m-d H:i:s', $time);<br />		if($actionTime >= date('Y-m-d H:i:s', $time)){<br />			$actionNo = date('Yz', $time)-6;<br />		}else{<br />			$actionNo = date('Yz', $time)-6;<br />			$actionTime=date('Y-m-d 18:30', $time);<br />		}<br />	}

上面代码读取的年和号,如201456我想改成2014056增加一位,请问怎么改?
------解决方案--------------------
public function pai3(&$actionNo, &$actionTime, $time=null){<br />		$this->setTimeNo($actionTime, $time);<br />		//echo $actionTime,' ',date('Y-m-d H:i:s', $time);<br />		$year = date('Y', $time);<br />		$day = str_pad(date('z',$time),3,'0',STR_PAD_LEFT);<br />		$times = $year.$day;<br />		if($actionTime >= date('Y-m-d H:i:s', $time)){<br />			<br />			$actionNo = $times-6;<br />		}else{<br />			$actionNo = $times-6;<br />			$actionTime=date('Y-m-d 18:30', $time);<br />		}<br />	}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn