All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
php时间加减_php资料_编程技术

Writer: delv Article type: Programming skills(编程技巧) Time: 2013/12/29 4:41:52 Browse times: 474 Comment times: 0

php时间加减_php资料_编程技术


Head photo

Go homepage
Upload pictures
Write articles

php时间加减_php资料_编程技术-你的首页-uuhomepage.com
下列收集日期计算的方法:
某个日期加几天:
$tdate=date("Y-m-d");
$a=date( "Y-m-d", mktime(0,0,0,date("m"),date("d")+3,date("Y")));
$sql="select * from memo where username='$session_user_id'
and compid=$compid and telldate>='$tdate' and telldate<='$a'
order by id desc"; $ret=mysql_query($sql,$conn);
$a就是今天+三天的时间! $b=date( "Y-m-d", mktime(0,0,0,date("m"),date("d")-3,date("Y"))); 
$b就是今天-三天的时间!
////
某个日期加n天后的日期
$days=abs((strtotime(date("Y-m-d"))-strtotime("xxxx-xx-xx"))/86400);
/////
="2003-7-15";//也可以是:$Date_1="2003-7-15 23:29:14"; $Date_2="1982-10-1"; 
$d1=strtotime($Date_1); $d2=strtotime($Date_2); $Days=round(($d1-$d2)/3600/24);
Echo
"偶已经奋斗了 $Days 天^_^";





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.