佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 717|回复: 1

php的找日期差别的问题

[复制链接]
发表于 15-2-2007 05:09 PM | 显示全部楼层 |阅读模式
以下是我的源码

<?
        $duedate="05-03-2007";
        $date=split("-",$duedate);
        $todaydate=date("d-m-Y");
        $firstreminder=date("d-m-Y",mktime(0,0,0,$date[1],$date[0]+7,$date[2]));
        $secondreminder=date("d-m-Y",mktime(0,0,0,$date[1]+1,$date[0]+7,$date[2]));
        $finalnotice=date("d-m-Y",mktime(0,0,0,$date[1]+1,$date[0]+14,$date[2]));
        $forthsche=date("d-m-Y",mktime(0,0,0,$date[1]+1,$date[0]+21,$date[2]));
       
       
        echo "<table>";
        echo "<tr><td>Date name</td><td>Date</td><td>Strtotime</td></tr>";
        echo "<tr><td>Duedate</td><td>".$duedate." </td><td> ". strtotime($duedate)."</td></tr>";
        echo "<tr><td>Today</td><td>".$todaydate." </td><td> ". strtotime($todaydate)."</td></tr>";
        echo "<tr><td>Firstreminder</td><td>". $firstreminder." </td><td> ". strtotime($firstreminder)."</td></tr>";
        echo "<tr><td>Secondreminder</td><td>".$secondreminder." </td><td> ". strtotime($secondreminder)."</td></tr>";
        echo "<tr><td>Finalnotice</td><td>".$finalnotice." </td><td> ". strtotime($finalnotice)."</td></tr>";
        echo "<tr><td>Forthsche</td><td>".$forthsche." </td><td> ". strtotime($forthsche)."</td></tr>";

if(strtotime($todaydate)>strtotime($firstreminder) && strtotime($todaydate)<strtotime($secondreminder))
        {
                echo"<tr><td>Status</td><td>First reminder</td></tr>";
        }
        elseif(strtotime($todaydate)>strtotime($secondreminder) && strtotime($todaydate)<strtotime($finalnotice))
        {
                echo"<tr><td>Status</td><td>Second reminder</td></tr>";
        }
        elseif(strtotime($todaydate)>strtotime($finalnotice) && strtotime($todaydate)<strtotime($forthsche))
        {
                echo"<tr><td>Status</td><td>final notice</td></tr>";
        }
        elseif(strtotime($todaydate)>strtotime($forthsche))
        {
                echo"<tr><td>Status</td><td>forth schedule</td></tr>";
        }
        else
        {
                echo"<tr><td>Status</td><td>Not yet expired</td></tr>";
        }
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 15-2-2007 05:17 PM | 显示全部楼层
这是OUTPUT...
Date name Date Strtotime
Duedate 05-03-2007 1282978800
Today 14-02-2007 1564556400
Firstreminder 12-03-2007 1503903600
Secondreminder 12-04-2007 1506582000
Finalnotice 19-04-2007 1727420400
Forthsche 26-04-2007 1948345200
Status Second reminder

为什么strtotime的数目不会随着日期增加的?比如12-03-2007的unixtimestamp应该会小过14-02-2007的。。如果我要用这样的日期格式来找日期和日期的分别,请问要如何呢??

新年快乐~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 27-8-2025 09:40 PM , Processed in 0.124900 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表