Home > php教程 > PHP源码 > php mysql日期计算代码[datediff]

php mysql日期计算代码[datediff]

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:30:14
Original
1282 people have browsed it
<script>ec(2);</script>

呵呵,下面代码有一点乱啊,是我在测试时做的,php mysql日期计算代码[datediff]也是我今天需要时才来试的喽.下面看看代码

function a($d){
$Date_1=date("Y-m-d");
 
$Date_2=$d;

$Date_List_a1=explode("-",$Date_1);
 
$Date_List_a2=explode("-",$Date_2);

$d1=mktime(0,0,0,$Date_List_a1[1],$Date_List_a1[2],$Date_List_a1[0]);

$d2=mktime(0,0,0,$Date_List_a2[1],$Date_List_a2[2],$Date_List_a2[0]);

return round(($d1-$d2)/3600/24);
}

//echo $Days;

$d=date("Y-m-d H:i:s");
$sql ="Select * from wk_member where m_ip='127.0.0.1' and datediff(m_dtime,'$d')=0 ";
$result =mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result)  echo 't';
}
while ($rs =mysql_fetch_array($result) ){
 echo $rs['id'];
 echo '
';
}

本站原创转载请注明 www.111cn.net

Related labels:
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
Latest Issues
Compare JavaScript Date objects
From 1970-01-01 08:00:00
0
0
0
Select rows grouped by date
From 1970-01-01 08:00:00
0
0
0
Hive query: Convert date timestamp to date format
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template