Exemplo n.º 1
0
function dureeMinute($heuredebut, $heurefin)
{
    // Calcule la durée en minute
    $duree = mktime(heure($heurefin), minute($heurefin), 0, 0, 0, 1) - mktime(heure($heuredebut), minute($heuredebut), 0, 0, 0, 1);
    $duree = round($duree / 60);
    return $duree;
}
Exemplo n.º 2
0
 public static function generateStreamIDHash($url, $deterministic)
 {
     // For load balancing purposes, the hash should be spread as randomly
     // as possible.
     if ($deterministic) {
         // randomize deterministically:
         $randomize = self::createHash($url);
     } else {
         // randomize based on current time:
         $randomize(hour(now) & minute(now) & second(now));
     }
     $streamidhash = 0;
     srand();
     // generate random serial number between 0 and 15
     $streamidhash = rand(0, 15);
     //echo "DEBUG: Raw streamidhash is $streamidhash\n";
     $streamidhash = dechex($streamidhash);
     return $streamidhash;
 }
Exemplo n.º 3
0
function format_Time($timeStr, $nType)
{
    $y = '';
    $m = '';
    $d = '';
    $h = '';
    $mi = '';
    $s = '';
    $format_Time = '';
    if (isDate($timeStr) == false) {
        return @$format_Time;
    }
    $y = cStr(year($timeStr));
    $m = cStr(month($timeStr));
    if (len($m) == 1) {
        $m = '0' . $m;
    }
    $d = cStr(day($timeStr));
    //在vb.net里要这样用  D = CStr(CDate(timeStr).Day)
    if (len($d) == 1) {
        $d = '0' . $d;
    }
    $h = cStr(hour($timeStr));
    if (len($h) == 1) {
        $h = '0' . $h;
    }
    $mi = cStr(minute($timeStr));
    if (len($mi) == 1) {
        $mi = '0' . $mi;
    }
    $s = cStr(second($timeStr));
    if (len($s) == 1) {
        $s = '0' . $s;
    }
    switch ($nType) {
        case 1:
            //yyyy-mm-dd hh:mm:ss
            $format_Time = $y . '-' . $m . '-' . $d . ' ' . $h . ':' . $mi . ':' . $s;
            break;
        case 2:
            //yyyy-mm-dd
            $format_Time = $y . '-' . $m . '-' . $d;
            break;
        case 3:
            //hh:mm:ss
            $format_Time = $h . ':' . $mi . ':' . $s;
            break;
        case 4:
            //yyyy年mm月dd日
            $format_Time = $y . '年' . $m . '月' . $d . '日';
            break;
        case 5:
            //yyyymmdd
            $format_Time = $y . $m . $d;
            break;
        case 6:
            //yyyymmddhhmmss
            $format_Time = $y . $m . $d . $h . $mi . $s;
            break;
        case 7:
            //mm-dd
            $format_Time = $m . '-' . $d;
            break;
        case 8:
            //yyyy年mm月dd日
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . ':' . $mi . ':' . $s;
            break;
        case 9:
            //yyyy年mm月dd日H时mi分S秒 早上
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分' . $s . '秒,' . getDayStatus($h, 1);
            break;
        case 10:
            //yyyy年mm月dd日H时
            $format_Time = $y . '年' . $m . '月' . $d . '日' . $h . '时';
            break;
        case 11:
            //yyyy年mm月dd日H时mi分S秒
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分' . $s . '秒';
            break;
        case 12:
            //yyyy年mm月dd日H时mi分
            $format_Time = $y . '年' . $m . '月' . $d . '日' . ' ' . $h . '时' . $mi . '分';
            break;
        case 13:
            //yyyy年mm月dd日H时mi分 早上
            $format_Time = $m . '月' . $d . '日' . ' ' . $h . ':' . $mi . ' ' . getDayStatus($h, 0);
            break;
        case 14:
            //yyyy年mm月dd日
            $format_Time = $y . '/' . $m . '/' . $d;
            break;
        case 15:
            //yyyy年mm月 第1周
            $format_Time = $y . '年' . $m . '月 第' . GetCountPage($d, 7) . '周';
    }
    return @$format_Time;
}