PHP
·
发表于 5年以前
·
阅读量:8309
±¾ÎÄʵÀý½²ÊoÁËPHPʹÓÃstrtotime¼ÆËaÁ½¸o¸ø¶¨ÈÕÆÚÖ®¼aÌiÊýµÄ½¨¡£ÖÏi¸ø´o¼Ò¹(C)´o¼Ò²Î¿¼¡£¾ßÌaÖÎoÈçÏ£º
PHPµÄstrtotimeº¯ÊýÓÃÓÚ½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼aÃeÊo½aÎoΪUnixʱ¼a´Á¡£Õa¸oº¯Êý½«Ê¹ÓÃTZ»¾³±aÁ¿£¨Èç¹uÓеĻ°£(C)À´¼ÆËaʱ¼a´Á¡£Èç¹uÖ´Ðгɹ¦Ëuµ»ØÒ»¸oʱ¼a´Á£¬ñÔoµ»ØFALSE¡£ÔÚPHP 5.1.0֮ǰ£¬Õa¸oº¯Êý½«*µ»Ø-1¡£
$date1 = date('Y-m-d');
$date2 = '2005-03-01¡a;
$days = (strtotime() ¨C strtotime()) / (60 * 60 * 24);
echo "Number of days since '2005-03-01¡a: $days";
Ï£Íu±¾ÎÄËuÊo¶Ô´o¼ÒµÄphp³ÌÐoÉe¼ÆÓÐËu°iÖu¡£