php group purchase countdown code

巴扎黑
Release: 2016-11-23 13:25:15
Original
1153 people have browsed it

<?php 

//$a = strtotime(date("Y-m-d H:i:s")); 

$a =  strtotime(date("2012-5-28  17:50:51"));//自定义时间 
$b = $a+24*3600;//24小时后的时间戳的值 
$d = $a-24*3600;//24小时前的时间戳的值 
echo date("Y-m-d H:i:s",$b);//24小时后的时间 
echo "</br>"; 
echo date("Y-m-d H:i:s",$d);//24小时前的时间 
echo "</br>"; 
$c=mktime();//当前时间戳值 
echo date("Y-m-d H:i:s");//当前时间 
echo "</br>"; 
echo $c;//当前时间戳值 
echo "</br>"; 
echo(strtotime("+5 hours")); //5小时后的时间戳值 
echo "</br>"; 
$f=$b-$c; 
echo  strtotime(date("Y-m-d H:i:s",$f));//离24小时后的剩余的时间戳。(秒) 
echo "</br>"; 

///$days; 
//$hours; 
//$minute; 
//$second; 



$seconds=$f; 
//$seconds=3722; 

$second=$seconds%60; 

$minute=(int)($seconds/60); 
//$minute=var_dump((int) ($seconds/60));测试代码 
//echo $minute; 
//echo (int)$chushu; 

$minutes=$minute%60; 
$hours=(int)($minute/60); 

if($seconds>60){ 
if($minute>60){ 
echo &#39;剩余时间:  &#39;; 
echo $hours.&#39;小时&#39;.$minutes.&#39;分&#39;.$second.&#39;秒&#39;; 

} 
else{ 
echo $minutes.&#39;分&#39;.$second.&#39;秒&#39;; 
} 
}else{ 
if($f<=0){echo &#39;你可以投票了&#39;;} 
else{ 
echo $seconds.&#39;秒&#39;; 
} 
} 
?>
Copy after login


Related labels:
php
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