標題: php 幫忙修正
 冰箱裡的18號
 0099582
Rank: 1

頭銜: Newbie

帖子: 4

精華: 0

積分: -87 點

現金: -101 元

存款: 0 元

閱讀權限: 10

註冊: 2008-4-9

狀態: 離線
 
發表於 2008-7-26 19:47  資料  個人空間  短消息  加為好友 
php 幫忙修正

php 幫忙修正

[顯示] [隱藏]
Warning:  mktime() expects parameter 1 to be long, string given in /home/mkstation/domains/mongkokstation.com/public_html/bidbid/config/datecalc.php on line 62


<?
## v5.20 -> jun. 29, 2005
function closingdate ($thedate,$offset) {
    $getlocaldiff=mysql_query("SELECT * FROM probid_timesettings WHERE active='selected'");
        $diff=mysql_result($getlocaldiff,0,"value");

    $splitted = explode (" ",$thedate);
    $ourdate = explode ("-",$splitted[0]);
    list($ryear, $rmonth, $rday) = $ourdate;
    $ourtime = explode (":",$splitted[1]);
    list($rhour,$rmin,$rsec) = $ourtime;

    $date = strftime("%Y-%m-%d %H:%M:%S",
      mktime($rhour,$rmin,$rsec,$rmonth,$rday+$offset,$ryear));
    return $date;
}

function convertdate ($thedate,$format) {
    $getlocaldiff=mysql_query("SELECT * FROM probid_timesettings WHERE active='selected'");
        $diff=mysql_result($getlocaldiff,0,"value");

    $splitted = explode (" ",$thedate);
    $ourdate = explode ("-",$splitted[0]);
    list($ryear, $rmonth, $rday) = $ourdate;
    $ourtime = explode (":",$splitted[1]);
    list($rhour,$rmin,$rsec) = $ourtime;

    $date = date($format,
      mktime($rhour+$diff,$rmin,$rsec,$rmonth,$rday,$ryear));
    return $date;
}

function displaydatetime($thedate,$format) {
    $getlocaldiff=mysql_query("SELECT * FROM probid_timesettings WHERE active='selected'");
        $diff=mysql_result($getlocaldiff,0,"value");

    $splitted = explode (" ",$thedate);
    $ourdate = explode ("-",$splitted[0]);
    list($ryear, $rmonth, $rday) = $ourdate;
    $ourtime = explode (":",$splitted[1]);
    list($rhour,$rmin,$rsec) = $ourtime;

    $date = date($format,
      mktime($rhour+$diff,$rmin,$rsec,$rmonth,$rday,$ryear));
    return $date;
}

function daysleft($date,$format) {

### this function will return the number of seconds between 2 dates!!
    $today=date("Y-m-d H:i:s");
    $split_datenow=explode (" ",$today);
    $date_now=explode ("-",$split_datenow[0]);
    list ($nyear,$nmonth,$nday)=$date_now;
    $time_now=explode (":",$split_datenow[1]);
    list ($nhour,$nmin,$nsec)=$time_now;
    $datenow=mktime($nhour,$nmin,$nsec,$nmonth,$nday,$nyear);
   
    $arrDateTime = explode(" ", $date);
    $arrDate = explode("-", $arrDateTime[0]);
    $arrTime = explode(":", $arrDateTime[1]);
    $daysleft=mktime($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]);

    $daycount=intval($daysleft-$datenow);
   
   
    return $daycount;
}

function timeleft($date,$format) {
    ## revamped function -> v5.20
    $currentTime = time();
        
    $arrDateTime = explode(" ", $date);
    $arrDate = explode("-", $arrDateTime[0]);
    $arrTime = explode(":", $arrDateTime[1]);

    $endDate = mktime($arrTime[0],$arrTime[1],$arrTime[2],$arrDate[1],$arrDate[2],$arrDate[0]);
   
    $secondsLeft = $endDate - $currentTime;

    $day = 24*60*60;
    $hour = 60*60;
    $minute = 60;
   
    $daysLeft = floor($secondsLeft/$day);
    $hours = $secondsLeft - ($daysLeft * $day);
    $hoursLeft = floor($hours/$hour);
    $minutes = $hours - ($hoursLeft * $hour);
    $minutesLeft = floor($minutes/$minute);
   
    $timecount = (($daysLeft>0) ? $daysLeft." days, " : "").(($hoursLeft>0||$daysLeft>0) ? $hoursLeft."h " : "").$minutesLeft."m";
   
    return $timecount;
}

function convert_date($date) {
// ###############################
// this function converts a UNIX timestamp into a date
    $result=date("M. j, Y",$date);
    return $result;
}

?>




 AL8 Forum © All rights reserved.
頂部
 ProSPY001
 0012406
Rank: 3Rank: 3Rank: 3
點擊查看 ProSPY001 的詳細資料

頭銜: Conqueror

帖子: 217

精華: 0

積分: 1620 點

現金: 0 元

存款: 18173 元

閱讀權限: 20

註冊: 2004-11-30

來自: SPY NET

狀態: 離線
 
發表於 2008-7-27 18:51  資料  個人空間  主頁 短消息  加為好友 
Try this

function daysleft($date,$format) {

### this function will return the number of seconds between 2 dates!!
    $today=date("Y-m-d H:i:s");
    $split_datenow=explode (" ",$today);
    $date_now=explode ("-",$split_datenow[0]);
    list ($nyear,$nmonth,$nday)=$date_now;
    $time_now=explode (":",$split_datenow[1]);
    list ($nhour,$nmin,$nsec)=$time_now;
    $datenow=mktime($nhour,$nmin,$nsec,$nmonth,$nday,$nyear);
   
    $arrDateTime = explode(" ", $date);
    $arrDate = explode("-", $arrDateTime[0]);
    $arrTime = explode(":", $arrDateTime[1]);
    $daysleft=mktime((int)$arrTime[0],(int)$arrTime[1],(int)$arrTime[2],(int)$arrDate[1],(int)$arrDate[2],(int)$arrDate[0]);

    $daycount=intval($daysleft-$datenow);
   
   
    return $daycount;
}




快加入http://sp.danielhk.com,版主大招募現正進行中
 AL8 Forum © All rights reserved.
頂部


網頁空間由 I-SERVICES 提供
當前時區 GMT+8, 現在時間是 2008-12-5 12:36