• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP gmmktime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中gmmktime函数的典型用法代码示例。如果您正苦于以下问题:PHP gmmktime函数的具体用法?PHP gmmktime怎么用?PHP gmmktime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了gmmktime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: display_tpotm

    public function display_tpotm($event)
    {
        $now = time();
        $date_today = gmdate("Y-m-d", $now);
        list($year_cur, $month_cur, $day1) = split('-', $date_today);
        // Start time for current month
        $month_start_cur = gmmktime(0, 0, 0, $month_cur, 1, $year_cur);
        $month_start = $month_start_cur;
        $month_end = $now;
        // group_id 5 = administrators
        // group_id 4 = global moderators
        // this groups belong to a Vanilla 3.1.x board
        $sql = 'SELECT u.username, u.user_id, u.user_colour, u.user_type, u.group_id, COUNT(p.post_id) AS total_posts
			FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p
				WHERE u.user_id > ' . ANONYMOUS . '
					AND u.user_id = p.poster_id
						AND p.post_time BETWEEN ' . $month_start . ' AND ' . $month_end . '
							AND (u.user_type <> ' . USER_FOUNDER . ')
								AND (u.group_id <> 5)
									AND (u.group_id <> 4)
			GROUP BY u.user_id
			ORDER BY total_posts DESC';
        $result = $this->db->sql_query_limit($sql, 1);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // let's go then..
        // posts made into the selected elapsed time
        $topm_tp = $row['total_posts'];
        $topm_un = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
        // there is not a Top Poster, usually happens with fresh installations, where only the FOUNDER made the first post/topic. Or no normal users already did it.
        //Here TOPM_UN reflects this state.
        $this->template->assign_vars(array('TOPM_UN' => $topm_tp < 1 ? $topm_un = $this->user->lang['TOP_USERNAME_NONE'] : $topm_un, 'L_TPOTM' => $this->user->lang['TOP_CAT'], 'L_TOPM_UNA_L' => $this->user->lang['TOP_USERNAME'], 'L_TOPM_UPO_L' => sprintf($this->user->lang['TOP_USER_MONTH_POSTS'], $topm_tp), 'L_TOPM_POSTS_L' => $topm_tp > 1 || $topm_tp == 0 ? $this->user->lang['TOP_POSTS'] : $this->user->lang['TOP_POST']));
    }
开发者ID:alhitary,项目名称:tpotm,代码行数:33,代码来源:listener.php


示例2: post_notification_mysql2gmdate

function post_notification_mysql2gmdate($mysqlstring)
{
    if (empty($mysqlstring)) {
        return false;
    }
    return gmmktime((int) substr($mysqlstring, 11, 2), (int) substr($mysqlstring, 14, 2), (int) substr($mysqlstring, 17, 2), (int) substr($mysqlstring, 5, 2), (int) substr($mysqlstring, 8, 2), (int) substr($mysqlstring, 0, 4));
}
开发者ID:jrep20,项目名称:samcozen,代码行数:7,代码来源:functions.php


示例3: buildQuery

 /**
  * Builds the query for this datagrid
  *
  * @return array An array with two arguments containing the query and its parameters.
  */
 private function buildQuery()
 {
     $parameters = array($this->id);
     // start query, as you can see this query is build in the wrong place,
     // because of the filter it is a special case
     // wherein we allow the query to be in the actionfile itself
     $query = 'SELECT i.id, UNIX_TIMESTAMP(i.sent_on) AS sent_on
          FROM forms_data AS i
          WHERE i.form_id = ?';
     // add start date
     if ($this->filter['start_date'] !== '') {
         // explode date parts
         $chunks = explode('/', $this->filter['start_date']);
         // add condition
         $query .= ' AND i.sent_on >= ?';
         $parameters[] = BackendModel::getUTCDate(null, gmmktime(23, 59, 59, $chunks[1], $chunks[0], $chunks[2]));
     }
     // add end date
     if ($this->filter['end_date'] !== '') {
         // explode date parts
         $chunks = explode('/', $this->filter['end_date']);
         // add condition
         $query .= ' AND i.sent_on <= ?';
         $parameters[] = BackendModel::getUTCDate(null, gmmktime(23, 59, 59, $chunks[1], $chunks[0], $chunks[2]));
     }
     // new query
     return array($query, $parameters);
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:33,代码来源:Data.php


示例4: setTime

 /**
  * Set the time
  * @access protected This class is immutable, so this is protected. Only the constructor calls it.
  */
 protected function setTime($hour = null, $minute = null, $second = null, $rollover = null)
 {
     if (is_null($hour)) {
         $hour = gmdate("H");
     }
     if (is_null($minute)) {
         $minute = gmdate("i");
     }
     if (is_null($second)) {
         $second = gmdate("s");
     }
     if (is_null($rollover)) {
         $rollover = false;
     }
     if (!$rollover) {
         if ($hour > 23 || $minute > 59 || $second > 59) {
             throw new qCal_DateTime_Exception_InvalidTime(sprintf("Invalid time specified for qCal_Time: \"%02d:%02d:%02d\"", $hour, $minute, $second));
         }
     }
     // since PHP is incapable of storing a time without a date, we use the first day of
     // the unix epoch so that we only have the amount of seconds since the zero of unix epoch
     // we only use gm here because we don't want the server's timezone to interfere
     $time = gmmktime($hour, $minute, $second, 1, 1, 1970);
     $this->time = $time;
     $formatString = "a|A|B|g|G|h|H|i|s|u";
     $keys = explode("|", $formatString);
     $vals = explode("|", gmdate($formatString, $this->getTimestamp(false)));
     $this->timeArray = array_merge($this->timeArray, array_combine($keys, $vals));
     return $this;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:34,代码来源:Time.php


示例5: _init

 /**
  * This method parses branches even though RCS doesn't support
  * branches. But rlog from the RCS tools supports them, and displays them
  * even on RCS repositories.
  */
 protected function _init()
 {
     $raw = $this->_file->getAccum();
     /* Initialise a simple state machine to parse the output of rlog */
     $state = 'init';
     while (!empty($raw) && $state != 'done') {
         switch ($state) {
             /* Found filename, now looking for the revision number */
             case 'init':
                 $line = array_shift($raw);
                 if (preg_match("/revision (.+)\$/", $line, $parts)) {
                     $this->_rev = $parts[1];
                     $state = 'date';
                 }
                 break;
                 /* Found revision and filename, now looking for date */
             /* Found revision and filename, now looking for date */
             case 'date':
                 $line = array_shift($raw);
                 if (preg_match("|^date:\\s+(\\d+)[-/](\\d+)[-/](\\d+)\\s+(\\d+):(\\d+):(\\d+).*?;\\s+author:\\s+(.+);\\s+state:\\s+(\\S+);(\\s+lines:\\s+\\+(\\d+)\\s\\-(\\d+))?|", $line, $parts)) {
                     $this->_date = gmmktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]);
                     $this->_author = $parts[7];
                     $this->_state = $parts[8];
                     if (isset($parts[9])) {
                         $this->_lines = '+' . $parts[10] . ' -' . $parts[11];
                         $this->_files[$this->_file->getSourcerootPath()] = array('added' => $parts[10], 'deleted' => $parts[11]);
                     }
                     $state = 'branches';
                 }
                 break;
                 /* Look for a branch point here - format is 'branches:
                  * x.y.z; a.b.c;' */
             /* Look for a branch point here - format is 'branches:
              * x.y.z; a.b.c;' */
             case 'branches':
                 /* If we find a branch tag, process and pop it,
                    otherwise leave input stream untouched */
                 if (!empty($raw) && preg_match("/^branches:\\s+(.*)/", $raw[0], $br)) {
                     /* Get the list of branches from the string, and
                      * push valid revisions into the branches array */
                     $brs = preg_split('/;\\s*/', $br[1]);
                     foreach ($brs as $brpoint) {
                         if ($this->_rep->isValidRevision($brpoint)) {
                             $this->_branches[] = $brpoint;
                         }
                     }
                     array_shift($raw);
                 }
                 $state = 'done';
                 break;
         }
     }
     /* Assume the rest of the lines are the log message */
     $this->_log = implode("\n", $raw);
     $this->_tags = $this->_file->getRevisionSymbol($this->_rev);
     $this->_setSymbolicBranches();
     $branches = $this->_file->getBranches();
     $key = array_keys($branches, $this->_rev);
     $this->_branch = empty($key) ? array_keys($branches, $this->_rep->strip($this->_rev, 1)) : $key;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:65,代码来源:Rcs.php


示例6: xfac_sync_mysqlDateToGmtTimestamp

function xfac_sync_mysqlDateToGmtTimestamp($string)
{
    if (preg_match('/^(\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)$/', trim($string), $m)) {
        return gmmktime($m[4], $m[5], $m[6], $m[2], $m[3], $m[1]);
    }
    return 0;
}
开发者ID:burtay,项目名称:bdApi,代码行数:7,代码来源:sync.php


示例7: __construct

 /**
  * Initiate current time list.
  *
  * @param Ai1ec_Registry_Object $registry
  *
  * @return void
  */
 public function __construct(Ai1ec_Registry_Object $registry)
 {
     parent::__construct($registry);
     $gmt_time = version_compare(PHP_VERSION, '5.1.0') >= 0 ? time() : gmmktime();
     $this->_current_time = array((int) $_SERVER['REQUEST_TIME'], $gmt_time);
     $this->_gmtdates = $registry->get('cache.memory');
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:14,代码来源:system.php


示例8: getDefaultFileName

 public static function getDefaultFileName($time = null)
 {
     if (empty($time)) {
         $time = gmmktime();
     }
     return self::$filePrefix . gmdate('d_M_Y-H_i_s-T', $time) . '.zip';
 }
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:7,代码来源:BackupZip.php


示例9: smarty_modifier_nicetime

function smarty_modifier_nicetime($string)
{
    if (ereg('(19|20[0-9]{2})[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]) ([012 ][0-9])[: .]([0-5][0-9])[: .]([0-5][0-9])[ \\.].*', $string, $regs)) {
        $unixtime = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
        $time = time() + 28800 - $unixtime;
        if ($time < 24 * 3600 * 5) {
            if ($time < 48 * 3600) {
                if ($time < 24 * 3600) {
                    if ($time < 5 * 3600) {
                        if ($time < 3600) {
                            if ($time < 60) {
                                return $time . '秒前';
                            } else {
                                return floor($time / 60) . '分钟前';
                            }
                        } else {
                            $min = floor($time % 3600 / 60);
                            return floor($time / 3600) . '小时' . ($min > 0 ? $min . '分钟' : '') . '前';
                        }
                    } else {
                        return '今天 ' . $regs[4] . ':' . $regs[5] . ':' . $regs[6];
                    }
                } else {
                    return '昨天';
                }
            } else {
                return floor($time / (24 * 3600)) . '天前';
            }
        } else {
            return $string;
        }
    } else {
        return $string;
    }
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:35,代码来源:modifier.nicetime.php


示例10: wp_days_ago

function wp_days_ago($mode = 0, $prepend = "", $append = "", $texts = array("Today", "Yesterday", "One week ago", "days ago", "year", "years", "ago", "day ago", "days ago", "Just now", "One minute ago", "minutes ago", "1 hour ago", "hours ago", "Some time in the future"))
{
    $days = round((strtotime(date("Y-m-d", gmmktime() + get_option('gmt_offset') * 3600)) - strtotime(date("Y-m-d", get_the_time("U")))) / 86400);
    $minutes = round((strtotime(date("Y-m-d H:i", gmmktime() + get_option('gmt_offset') * 3600)) - strtotime(date("Y-m-d H:i", get_the_time("U")))) / 60);
    $output = $prepend;
    if ($minutes < 0) {
        $output .= $texts[14];
    } else {
        if ($mode == 0 && $minutes < 1440) {
            if ($minutes == 0) {
                $output .= $texts[9];
            } else {
                if ($minutes == 1) {
                    $output .= $texts[10];
                } else {
                    if ($minutes < 60) {
                        $output .= $minutes . " " . $texts[11];
                    } else {
                        if ($minutes < 120) {
                            $output .= $texts[12];
                        } else {
                            $output .= floor($minutes / 60) . " " . $texts[13];
                        }
                    }
                }
            }
        } else {
            if ($days == 0) {
                $output = $output . $texts[0];
            } elseif ($days == 1) {
                $output = $output . $texts[1];
            } elseif ($days == 7) {
                $output = $output . $texts[2];
            } else {
                $years = floor($days / 365);
                if ($years > 0) {
                    if ($years == 1) {
                        $yearappend = $texts[4];
                    } else {
                        $yearappend = $texts[5];
                    }
                    $days = $days - 365 * $years;
                    if ($days == 0) {
                        $output = $output . $years . " " . $yearappend . " " . $texts[6];
                    } else {
                        if ($days == 1) {
                            $output = $output . $years . " " . $yearappend . ", " . $days . " " . $texts[7];
                        } else {
                            $output = $output . $years . " " . $yearappend . ", " . $days . " " . $texts[8];
                        }
                    }
                } else {
                    $output = $output . $days . " " . $texts[3];
                }
            }
        }
    }
    $output = $output . $append;
    echo $output;
}
开发者ID:alphaomegahost,项目名称:FIN,代码行数:60,代码来源:wp_days_ago.php


示例11: run_gmgetdate_assertion

 protected function run_gmgetdate_assertion()
 {
     $expected = time();
     $date_array = phpbb_gmgetdate($expected);
     $actual = gmmktime($date_array['hours'], $date_array['minutes'], $date_array['seconds'], $date_array['mon'], $date_array['mday'], $date_array['year']);
     $this->assertEquals($expected, $actual);
 }
开发者ID:josh-js,项目名称:phpbb,代码行数:7,代码来源:gmgetdate_test.php


示例12: _createElements

 function _createElements()
 {
     $this->_elements = array();
     for ($i = 1; $i <= 31; $i++) {
         $days[$i] = $i;
     }
     for ($i = 1; $i <= 12; $i++) {
         $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
     }
     for ($i = $this->_options['startyear']; $i <= $this->_options['stopyear']; $i++) {
         $years[$i] = $i;
     }
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
     // If optional we add a checkbox which the user can use to turn if on
     if ($this->_options['optional']) {
         $this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'off', null, get_string('disable'), $this->getAttributes(), true);
     }
     foreach ($this->_elements as $element) {
         if (method_exists($element, 'setHiddenLabel')) {
             $element->setHiddenLabel(true);
         }
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:25,代码来源:dateselector.php


示例13: ewiki_decode_datetime

function ewiki_decode_datetime($str, $localize = 1, $gmt = 0)
{
    $done = 0;
    $months = array_flip(array("Err", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"));
    #-- 8601
    if ($str[4] == "-" and preg_match("/(\\d+)-(\\d+)-(\\d+)(T(\\d+):(\\d+)(:(\\d+))?)?/", $str, $uu)) {
        $t = gmmktime($uu[5], $uu[6], $uu[8], $uu[2], $uu[3], $uu[1]);
    } elseif ($str[3] == " " and preg_match("/\\w+ (\\w+) +(\\d+) (\\d+):(\\d+):(\\d+) (\\d+)/", $str, $uu)) {
        $t = gmmktime($uu[3], $uu[4], $uu[5], $months[$uu[1]], $uu[2], $uu[6]);
        $gmt = 1;
    } elseif (1 and preg_match("/\\w+, (\\d+)[- ](\\w+)[- ](\\d+) (\\d+):(\\d+):(\\d+)/", $str, $uu)) {
        $t = gmmktime($uu[4], $uu[5], $uu[6], $months[$uu[2]], $uu[1], $uu[3]);
        $gmt = 1;
    } elseif ((int) $str == $str) {
        $t = (int) $str;
        $gmt = 1;
    } else {
        $t = strtotime($str);
        $gmt = 1;
    }
    #-- is local time (iso8601 only)
    if (!$gmt && $localize && preg_match('/([+-])(\\d+):(\\d+)$/', $str, $uu)) {
        $dt = $uu[1] * 60 + $uu[2];
        if ($uu[1] == "+") {
            $t -= $dt;
        } else {
            $t += $dt;
        }
    }
    return $t;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:31,代码来源:feedparse.php


示例14: number2Ts

 static function number2Ts($dateValue = 0, $base = 'win')
 {
     if ($base == 'win') {
         // Base date of 1st Jan 1900 = 1.0
         $myExcelBaseDate = 25569;
         //  Adjust for the spurious 29-Feb-1900 (Day 60)
         if ($dateValue < 60) {
             --$myExcelBaseDate;
         }
     } else {
         // Base date of 2nd Jan 1904 = 1.0
         $myExcelBaseDate = 24107;
     }
     // Perform conversion
     if ($dateValue >= 1) {
         $utcDays = $dateValue - $myExcelBaseDate;
         $returnValue = round($utcDays * 24 * 60 * 60);
         if ($returnValue <= PHP_INT_MAX && $returnValue >= -PHP_INT_MAX) {
             $returnValue = (int) $returnValue;
         }
     } else {
         $hours = round($dateValue * 24);
         $mins = round($dateValue * 24 * 60) - round($hours * 60);
         $secs = round($dateValue * 24 * 60 * 60) - round($hours * 60 * 60) - round($mins * 60);
         $returnValue = (int) gmmktime($hours, $mins, $secs);
     }
     // Return
     return $returnValue;
 }
开发者ID:trevorpao,项目名称:f3cms,代码行数:29,代码来源:XlsReadFilter.php


示例15: createEmail

 public static function createEmail($id = '', $override = array())
 {
     global $timedate;
     $time = mt_rand();
     $name = 'SugarEmail';
     $email = new Email();
     $email->name = $name . $time;
     $email->type = 'out';
     $email->status = 'sent';
     $email->date_sent = $timedate->to_display_date_time(gmdate("Y-m-d H:i:s", gmmktime() - 3600 * 24 * 2));
     // Two days ago
     if (!empty($id)) {
         $email->new_with_id = true;
         $email->id = $id;
     }
     foreach ($override as $key => $value) {
         $email->{$key} = $value;
     }
     $email->save();
     if (!empty($override['parent_id']) && !empty($override['parent_type'])) {
         self::createEmailsBeansRelationship($email->id, $override['parent_type'], $override['parent_id']);
     }
     self::$_createdEmails[] = $email;
     return $email;
 }
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:25,代码来源:SugarTestEmailUtilities.php


示例16: Auth_OpenID_splitNonce

function Auth_OpenID_splitNonce($nonce_string)
{
    // Extract a timestamp from the given nonce string
    $result = preg_match(Auth_OpenID_Nonce_REGEX, $nonce_string, $matches);
    if ($result != 1 || count($matches) != 8) {
        return null;
    }

    list($unused,
         $tm_year,
         $tm_mon,
         $tm_mday,
         $tm_hour,
         $tm_min,
         $tm_sec,
         $uniquifier) = $matches;

    $timestamp =
        @gmmktime($tm_hour, $tm_min, $tm_sec, $tm_mon, $tm_mday, $tm_year);

    if ($timestamp === false || $timestamp < 0) {
        return null;
    }

    return array($timestamp, $uniquifier);
}
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:26,代码来源:Nonce.php


示例17: mycal_build_calendar

function mycal_build_calendar($year, $month, $day, $events = array())
{
    $prevnext = array('&laquo;' => '/event/calendar/' . _mycal_format_date($year, $month - 1), '&raquo;' => '/event/calendar/' . _mycal_format_date($year, $month + 1));
    $first_day = 0;
    // First day is Sunday
    $first_of_month = gmmktime(0, 0, 0, $month, 1, $year);
    $day_names = array();
    // January 4, 1970 was a Sunday
    for ($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400) {
        $day_names[$n] = ucfirst(gmstrftime('%A', $t));
        #%A means full textual day name
    }
    list($month, $year, $month_name, $weekday) = explode(',', gmstrftime('%m,%Y,%B,%w', $first_of_month));
    $weekday = ($weekday + 7 - $first_day) % 7;
    // Adjust for $first_day
    $title = htmlentities(ucfirst($month_name)) . '&nbsp;' . $year;
    @(list($p, $pl) = each($prevnext));
    @(list($n, $nl) = each($prevnext));
    $p = '<a class="calendar-prev" href="' . htmlspecialchars($pl) . '">' . $p . '</a>';
    $n = '<a class="calendar-next" href="' . htmlspecialchars($nl) . '">' . $n . '</a>';
    $calendar = '<table class="calendar" summary="">' . "\n";
    $calendar .= '<caption class="calendar-month">' . $p . '<a href="/event/calendar/' . _mycal_format_date($year, $month) . '" class="calendar-title">' . $title . '</a>' . $n . "<br class=\"clear\"/></caption>\n<tr>\n";
    foreach ($day_names as $d) {
        $calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities(substr($d, 0, 3)) . ' </th>';
    }
    $calendar .= "</tr>\n<tr>";
    // Initial "empty" days
    if ($weekday > 0) {
        for ($i = 0; $i < $weekday; $i++) {
            $calendar .= '<td class="calendar-empty">&nbsp;</td>';
        }
    }
    for ($d = 1, $days_in_month = gmdate('t', $first_of_month); $d <= $days_in_month; $d++, $weekday++) {
        if ($weekday == 7) {
            // Start a new week
            $weekday = 0;
            $calendar .= "</tr>\n<tr>";
        }
        $class = 'calendar-day';
        $curr = date('Y-m-d', mktime(0, 0, 0, $month, $d, $year));
        if (isset($events[$curr])) {
            $class .= ' calendar-day-events';
            $content = '<a href="/event/calendar/' . _mycal_format_date($year, $month, $d) . '">' . $d . '</a>';
        } else {
            $content = $d;
        }
        if (null !== $day && $d == $day) {
            $class .= ' calendar-day-selected';
        }
        $calendar .= '<td class="' . $class . '">' . $content . '</td>';
    }
    // Remaining "empty" days
    if ($weekday != 7) {
        for ($i = 0; $i < 7 - $weekday; $i++) {
            $calendar .= '<td class="calendar-empty">&nbsp;</td>';
            #initial 'empty' days
        }
    }
    return $calendar . "</tr>\n</table>\n";
}
开发者ID:bradley-holt,项目名称:joind.in,代码行数:60,代码来源:mycal_helper.php


示例18: pleac_Printing_a_Date

function pleac_Printing_a_Date()
{
    // 'date' and 'strftime' both print a date string based on:
    // * Format String, describing layout of date components
    // * Timestamp [*NIX Epoch Seconds], either given explicitly, or implictly
    //   via a call to 'time' which retrieves current time value
    $ts = 1234567890;
    date('Y/m/d', $ts);
    date('Y/m/d', mktime($h, $m, $s, $mth, $d, $y, $is_dst));
    date('Y/m/d');
    // same as: date('Y/m/d', time());
    // ------------
    $ts = 1234567890;
    strftime('%Y/%m/%d', $ts);
    strftime('%Y/%m/%d', mktime($h, $m, $s, $mth, $d, $y, $is_dst));
    strftime('%Y/%m/%d');
    // same as: strftime('%Y/%m/%d', time());
    // ----------------------------
    // 'mktime' creates a local time timestamp
    $t = strftime('%a %b %e %H:%M:%S %z %Y', mktime(3, 45, 50, 1, 18, 73, TRUE));
    echo "{$t}\n";
    // 'gmmktime' creates a GMT time timestamp
    $t = strftime('%a %b %e %H:%M:%S %z %Y', gmmktime(3, 45, 50, 1, 18, 73));
    echo "{$t}\n";
    // ----------------------------
    // 'strtotime' parses a textual date expression, and generates a timestamp
    $t = strftime('%A %D', strtotime('18 Jan 1973, 3:45:50'));
    echo "{$t}\n";
    // This should generate output identical to previous example
    $t = strftime('%A %D', mktime(3, 45, 50, 1, 18, 73, TRUE));
    echo "{$t}\n";
}
开发者ID:Halfnhav4,项目名称:pfff,代码行数:32,代码来源:Printing_a_Date.php


示例19: get_related_dates

function get_related_dates($projectname, $basedate)
{
    include "cdash/config.php";
    require_once "cdash/pdo.php";
    $dates = array();
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    pdo_select_db("{$CDASH_DB_NAME}", $db);
    $dbQuery = pdo_query("SELECT nightlytime FROM project WHERE name='{$projectname}'");
    if (pdo_num_rows($dbQuery) > 0) {
        $project = pdo_fetch_array($dbQuery);
        $nightlytime = $project['nightlytime'];
        //echo "query result nightlytime: " . $nightlytime . "<br/>";
    } else {
        $nightlytime = "00:00:00";
        //echo "default nightlytime: " . $nightlytime . "<br/>";
    }
    if (!isset($basedate) || strlen($basedate) == 0) {
        $basedate = gmdate(FMT_DATE);
    }
    // Convert the nightly time into GMT
    $nightlytime = gmdate(FMT_TIME, strtotime($nightlytime));
    $nightlyhour = time2hour($nightlytime);
    $nightlyminute = time2minute($nightlytime);
    $nightlysecond = time2second($nightlytime);
    $basemonth = date2month($basedate);
    $baseday = date2day($basedate);
    $baseyear = date2year($basedate);
    $dates['nightly+2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 2, $baseyear);
    $dates['nightly+1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday + 1, $baseyear);
    $dates['nightly-0'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday, $baseyear);
    $dates['nightly-1'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 1, $baseyear);
    $dates['nightly-2'] = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $basemonth, $baseday - 2, $baseyear);
    // Snapshot of "now"
    //
    $currentgmtime = time();
    $currentgmdate = gmdate(FMT_DATE, $currentgmtime);
    // Find the most recently past nightly time:
    //
    $todaymonth = date2month($currentgmdate);
    $todayday = date2day($currentgmdate);
    $todayyear = date2year($currentgmdate);
    $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    while ($currentnightly > $currentgmtime) {
        $todayday = $todayday - 1;
        $currentnightly = gmmktime($nightlyhour, $nightlyminute, $nightlysecond, $todaymonth, $todayday, $todayyear);
    }
    $dates['now'] = $currentgmtime;
    $dates['most-recent-nightly'] = $currentnightly;
    $dates['today_utc'] = $currentgmdate;
    $dates['basedate'] = gmdate(FMT_DATE, $dates['nightly-0']);
    // CDash equivalent of DART1's "last rollup time"
    if ($dates['basedate'] === $dates['today_utc']) {
        // If it's today, it's now:
        $dates['last-rollup-time'] = $dates['now'];
    } else {
        // If it's not today, it's the nightly time on the basedate:
        $dates['last-rollup-time'] = $dates['nightly-0'];
    }
    return $dates;
}
开发者ID:rpshaw,项目名称:CDash,代码行数:60,代码来源:viewChanges.php


示例20: global_header_mobile

 function global_header_mobile()
 {
     global $_G, $show_message;
     function dsu_signtz()
     {
         dheader('Location: plugin.php?id=dsu_paulsign:sign&mobile=yes');
     }
     $var = $_G['cache']['plugin']['dsu_paulsign'];
     if (defined('IN_dsu_paulsign') || $show_message || defined('IN_dsu_paulsc') || !$_G['uid'] || !$var['ifopen'] || !$var['wap_sign']) {
         return '';
     }
     $tdtime = gmmktime(0, 0, 0, dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos'])) - $var['tos'] * 3600;
     $allowmem = memory('check');
     if ($var['ftopen'] && in_array($_G['groupid'], unserialize($var['tzgroupid'])) && !in_array($_G['uid'], explode(",", $var['ban'])) && in_array($_G['groupid'], unserialize($var['groups']))) {
         if ($allowmem && $var['mcacheopen']) {
             $signtime = memory('get', 'dsu_pualsign_' . $_G['uid']);
         }
         if (!$signtime) {
             $qiandaodb = DB::fetch_first("SELECT time FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'");
             $signtime = $qiandaodb['time'];
             $htime = dgmdate($_G['timestamp'], 'H', $var['tos']);
             if ($qiandaodb) {
                 if ($allowmem && $var['mcacheopen']) {
                     memory('set', 'dsu_pualsign_' . $_G['uid'], $qiandaodb['time'], 86400);
                 }
                 if ($qiandaodb['time'] < $tdtime) {
                     if ($var['timeopen']) {
                         if (!($htime < $var['stime']) && !($htime > $var['ftime'])) {
                             return dsu_signtz();
                         }
                     } else {
                         return dsu_signtz();
                     }
                 }
             } else {
                 $ttps = DB::fetch_first("SELECT posts FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'");
                 if ($var['mintdpost'] <= $ttps['posts']) {
                     if ($var['timeopen']) {
                         if (!($htime < $var['stime']) && !($htime > $var['ftime'])) {
                             return dsu_signtz();
                         }
                     } else {
                         return dsu_signtz();
                     }
                 }
             }
         } else {
             if ($signtime < $tdtime) {
                 if ($var['timeopen']) {
                     if (!($htime < $var['stime']) && !($htime > $var['ftime'])) {
                         return dsu_signtz();
                     }
                 } else {
                     return dsu_signtz();
                 }
             }
         }
     }
     return '<a href="plugin.php?id=dsu_paulsign:sign">' . lang('plugin/dsu_paulsign', 'name') . '</a>';
 }
开发者ID:sayhanabi,项目名称:sayhanabi_forum,代码行数:60,代码来源:sign_mobile.class.php



注:本文中的gmmktime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gmp_abs函数代码示例发布时间:2022-05-15
下一篇:
PHP gmgetdate函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap