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

关于PHP读取时间号码问题

WBOY
Release: 2016-06-23 14:28:15
Original
899 people have browsed it

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);		}	}
Copy after login

上面代码读取的年和号,如201456我想改成2014056增加一位,请问怎么改?


回复讨论(解决方案)

$year = date('Y', time());$day = str_pad(date('z',time()),3,'0',STR_PAD_LEFT);echo $year.$day;
Copy after login
Copy after login

$year = date('Y', time());$day = str_pad(date('z',time()),3,'0',STR_PAD_LEFT);echo $year.$day;
Copy after login
Copy after login

能加到我代码上发给我下吗

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);		}	}
Copy after login

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template