本文整理汇总了PHP中gmstrftime函数的典型用法代码示例。如果您正苦于以下问题:PHP gmstrftime函数的具体用法?PHP gmstrftime怎么用?PHP gmstrftime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gmstrftime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAllUser
public function showAllUser()
{
$i = 0;
$reply = "";
$sql = "SELECT * FROM `profile_data` ORDER BY `ID` ASC";
$con = new Connection();
$link = $con->getConnection();
$stmt = $link->prepare($sql);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_BOTH)) {
$i++;
$reply .= ' <li id="' . $row["ID"] . ' class="ui-responsive">
<a href="href=".../pages/?action=viewProfile&userid=' . $row["ID"] . '&viewer=admin">
<img class="profilepic" src="../css/images/logo1.png" alt="ECE-E-learning">
<div>
<h3 class="user">' . $row["l_name"] . " " . $row["m_name"] . " " . $row["f_name"] . '</h3>
<p class="topic"><strong>Reg No:' . $row["regno"] . '. Gender: ' . $row["gender"] . '. Marital Status: ' . $row["m_status"] . '.</strong></p>
<p><strong>' . $row["email"] . '. Phone:' . $row["phone"] . '</strong></p>
<p><strong>' . $row["address"] . '.</strong></p>
</div>
<div class="ui-li-aside ui-responsive"><p><strong>Joind:' . gmstrftime("%a, %b %d, %Y. Time:%I:%M:%S.%p", strtotime($row["signup_date"])) . '</strong></p>
<p>Last login:<strong>4:48</strong></p>
<p >Status:<strong class="status">' . $this->getUserStatus($row["user_id"]) . '</strong></p>
</div>
</a>
<a href="#" class="delete">Disable</a>
</li>';
}
//$stmt ->closeCursor();
return $reply;
}
示例2: downloadIcalFeed
/**
* Serve the iCalendar feed (valid for both download as .ics and webcal:// protocol)
*
* @return @e void
*/
public function downloadIcalFeed()
{
//-----------------------------------------
// Get main view class
//-----------------------------------------
$classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('calendar') . '/modules_public/calendar/view.php', 'public_calendar_calendar_view');
$calendar = new $classToLoad($this->registry);
$calendar->makeRegistryShortcuts($this->registry);
$calendar->initCalendar();
//-----------------------------------------
// Load (all) events
//-----------------------------------------
$calendar->calendarGetEventsSQL(gmstrftime('%m'), gmstrftime('%Y'), array('timenow' => '1', 'timethen' => '2000000000', 'cal_id' => $this->calendar['cal_id'], 'honor_permissions' => true, 'no_date_convert' => true));
$events = $calendar->calendarGetAllEvents();
//-----------------------------------------
// Load iCalendar class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . "/sources/icalendar.php", 'app_calendar_classes_icalendarOutput', 'calendar');
$iCalendar = new $classToLoad($this->registry, $this->calendar['cal_id']);
//-----------------------------------------
// Send data to iCalendar class and get output
//-----------------------------------------
foreach ($events as $event) {
$event = $calendar->calendarMakeEventHTML($event, true);
$iCalendar->addEvent($event);
}
$feed = $iCalendar->buildICalendarFeed();
//-----------------------------------------
// Output
//-----------------------------------------
@header("Content-type: text/calendar; charset=" . IPS_DOC_CHAR_SET);
@header("Content-Disposition: inline; filename=calendarEvents.ics");
print $feed;
exit;
}
示例3: filter_time
function filter_time($x,$t){
$y=gmstrftime('%H:%M',$x);
switch ($t) {
case 1: //for time in H:m
$null=gmstrftime('%H:%M',"0");
if ($y==$null){
$x="";
}
elseif($y<$null){
$x=gmstrftime('%H:%M',$x);
}
else
$x=gmstrftime('%H:%M',$x);
return $x;
break;
case 2: //for day
echo "i equals 1";
break;
case 3:
echo "i equals 2";
break;
}
}
示例4: marker
/**
* create marker with given data
* optionally add debug_backtrace and marker background color
* @param array $data
*
* @example marker(array('marker name'))
* @example marker(array('marker name', debug_backtrace()))
* @example marker(array('marker name', debug_backtrace(), '#000000'))
*/
public static function marker($data)
{
$defaultData = array('', null, null);
$data = array_merge($data, $defaultData);
if ((bool) self::$tracerOn) {
++self::$traceStep;
$time = microtime(true);
$time = preg_split('#\\.|,#', $time);
if (!isset($time[1])) {
$time[1] = 0;
}
$markerTime = gmstrftime('%d-%m-%Y<br/>%H:%M:%S:', $time[0]) . $time[1];
if (!$data[1]) {
$data[1] = array(array('file' => '', 'line' => '', 'function' => '', 'class' => '', 'type' => '', 'args' => ''));
}
if (isset($data[1][0]['args']) && is_array($data[1][0]['args'])) {
foreach ($data[1][0]['args'] as $arg => $val) {
if (is_object($val)) {
$data[1][0]['args'][$arg] = serialize($val);
}
}
}
self::$session['markers'][] = array('time' => $markerTime, 'name' => $data[0], 'debug' => $data[1], 'color' => $data[2]);
}
}
示例5: onOpen
function onOpen() {
$this->removeAll();
$d = $this->getDocument();
$l = $d->getLocale();
if($k = $this->getAttribute('key')) {
$time = $d->getVariable($k, time());
} else {
$time = time();
}
if($l) {
// If we have locale, we can use it to format values
$f = $this->getAttribute('format', null);
// Check if we have to format date or time
switch($this->getAttribute('mode')) {
case 'date':
$rv = $l->formatDate($time, $this->formats[$f]);
break;
case 'time':
$rv = $l->formatTime($time, $this->formats[$f]);
break;
default:
$rv = $l->formatDateTime($time, $f);
}
} else {
// Else pass to strftime()
$f = $this->getAttribute('format', '%H:%M:%S GMT');
$rv = gmstrftime($f, $time);
}
$n = new HTMLTextNode($this, $rv);
$this->addNode($n);
return self::PROCESS_BODY;
}
示例6: layout
/**
* list users
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!($delta = SQL::count($result))) {
return $text;
}
// flag idle users
$idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
// process all items in the list
$count = 0;
$items = array();
while ($item = SQL::fetch($result)) {
// url to view the user
$url = Users::get_permalink($item);
// initialize variables
$prefix = $suffix = '';
// signal restricted and private users
if (isset($item['active']) && $item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif (isset($item['active']) && $item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked profiles
if (isset($item['capability']) && $item['capability'] == '?') {
$prefix .= EXPIRED_FLAG;
}
// item title
if (isset($item['full_name']) && $item['full_name']) {
$label = ucfirst(Skin::strip($item['full_name'], 10));
$hover = $item['nick_name'];
} else {
$label = ucfirst(Skin::strip($item['nick_name'], 10));
$hover = $item['full_name'];
}
// flag idle users
if (!isset($item['click_date']) || $item['click_date'] < $idle) {
$class = 'idle user';
} else {
$class = 'user';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, $class, NULL, $hover);
// provide only some results
if (++$count >= 5) {
break;
}
}
// end of processing
SQL::free($result);
// turn this to some text
$text = Skin::build_list($items, 'comma');
// some indications on the number of connections
if ($delta -= $count) {
$text .= ', ...';
}
return $text;
}
示例7: mycal_build_calendar
function mycal_build_calendar($year, $month, $day, $events = array())
{
$prevnext = array('«' => '/event/calendar/' . _mycal_format_date($year, $month - 1), '»' => '/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)) . ' ' . $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"> </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"> </td>';
#initial 'empty' days
}
}
return $calendar . "</tr>\n</table>\n";
}
示例8: process
function process()
{
global $CONFIG;
$this->template_name = 'pages/team/ical.tpl';
$this->smarty->assign('team', $this->team);
$this->smarty->assign('short_league_name', variable_get('app_org_short_name', 'League'));
# Our timezone is specified as US/Eastern, but ical wants US-Eastern. bleh.
$timezone = preg_replace("!/!", "-", $CONFIG['localization']['local_tz']);
$this->smarty->assign('timezone', $timezone);
/*
* Grab schedule info
*/
$games = Game::load_many(array('either_team' => $this->team->team_id, 'published' => 1, '_order' => 'g.game_date DESC,g.game_start,g.game_id'));
// We'll be outputting an ical
header('Content-type: text/calendar; charset=UTF-8');
// Prevent caching
header("Cache-Control: no-cache, must-revalidate");
// get domain URL for signing games
$arr = explode('@', variable_get('app_admin_email', "@{$short_league_name}"));
$this->smarty->assign('domain_url', $arr[1]);
// date stamp this file
// MUST be in UTC
$this->smarty->assign('now', gmstrftime('%Y%m%dT%H%M%SZ'));
while (list(, $game) = each($games)) {
$opponent_id = $game->home_id == $this->team->team_id ? $game->away_id : $game->home_id;
$game->opponent = Team::load(array('team_id' => $opponent_id));
$game->field = Field::load(array('fid' => $game->fid));
}
$this->smarty->assign('games', $games);
}
示例9: publish
public function publish()
{
$link = 'http://projet.idleman.fr/PHPipe';
$rss = '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<title>' . $this->title . '</title>
<atom:link href="' . $this->link . '" rel="self" type="application/rss+xml"/>
<link>' . $this->link . '</link>
<description>Aggrégation des flux</description>
<language>fr-fr</language>
<copyright>DWTFYW</copyright>
<pubDate>' . date('r', gmstrftime(time())) . '</pubDate>
<lastBuildDate>' . date('r', gmstrftime(time())) . '</lastBuildDate>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>' . $this->title . '</generator>';
foreach ($this->events as $event) {
$rss .= '<item>
<title><![CDATA[' . $event->title . ']]></title>
<link>' . $event->link . '</link>
<pubDate>' . date('r', gmstrftime(strtotime($event->date))) . '</pubDate>
<guid isPermaLink="true">' . $event->link . '</guid>
<description>
<![CDATA[' . $event->description . ']]>
</description>
<content:encoded><![CDATA[' . $event->content . ']]></content:encoded>
<category>' . implode('|', $event->categories) . '</category>
<dc:creator>' . $event->creator . '</dc:creator>
</item>';
}
$rss .= '</channel></rss>';
return $rss;
}
示例10: dspSkinCSS_PageDidLoad
function dspSkinCSS_PageDidLoad()
{
// determine skin type/skin/theme
$cssTemplate = $skinName = $skinThemeName = NULL;
@(list(, , , $cssTemplate, $skinTypeName, $skinName, $skinThemeName) = split('/', $_SERVER['PATH_INFO']));
$cssFilePath = WFWebApplication::appDirPath(WFWebApplication::DIR_SKINS) . '/' . $skinTypeName . '/' . $skinName . '/' . $cssTemplate;
if (!file_exists($cssFilePath)) {
header("HTTP/1.0 404 Not Found");
print "No css file at: {$cssFilePath}";
exit;
}
// set the skin's wrapper information
$skin = $this->invocation->rootSkin();
$skin->setDelegateName($skinTypeName);
$skin->setSkin($skinName);
$skin->setTemplateType(WFSkin::SKIN_WRAPPER_TYPE_RAW);
$skin->setValueForKey($skinThemeName, 'skinThemeName');
// load the theme vars into our smarty for this module
$this->requestPage->assign('skinThemeVars', $skin->valueForKey('skinManifestDelegate')->loadTheme($skinThemeName));
$this->requestPage->assign('cssFilePath', $cssFilePath);
$this->requestPage->assign('skinDir', $skin->getSkinDir());
$this->requestPage->assign('skinDirShared', $skin->getSkinDirShared());
header("Content-Type: text/css");
// make CSS cacheable for a day at least
$seconds = 24 * 60 * 60;
// cache control - we can certainly safely cache the search results for 15 minutes
header('Pragma: ');
// php adds Pragma: nocache by default, so we have to disable it
header('Cache-Control: max-age=' . $seconds);
// Format: Fri, 30 Oct 1998 14:19:41 GMT
header('Expires: ' . gmstrftime("%a, %d %b %Y %T ", time() + $seconds) . ' GMT');
}
示例11: __construct
public function __construct()
{
parent::__construct();
$this->lastModified = gmstrftime("%a, %d %b %Y %T %Z", time());
$this->etag = '"' . dechex(mt_rand()) . ':' . dechex(mt_rand()) . '"';
$this->timer = new Timer();
}
示例12: main
public function main($UrlAppend = NULL, $get = NULL, $post = NULL)
{
if (!$_REQUEST['server_id'] || !$_REQUEST['sbm']) {
return $this->_assign;
}
$data = array('user' => trim($_GET['user']), 'userType' => trim($_GET['userType']), 'regBeginTime' => strtotime(trim($_GET['regBeginTime'])), 'regEndTime' => strtotime(trim($_GET['regEndTime'])), 'loginBeginTime' => strtotime(trim($_GET['loginBeginTime'])), 'loginEndTime' => strtotime(trim($_GET['loginEndTime'])), 'pageSize' => PAGE_SIZE, 'page' => max(1, intval($_GET['page'])));
$postData = $this->_gameObject->getPostData($post);
$postData = array_merge($data, $postData);
$data = $this->getResult($UrlAppend, $get, $postData);
if ($data['status'] == 1) {
if ($data['data']['list']) {
foreach ($data['data']['list'] as &$player) {
$player['id'] = $this->_d2s($player['id']);
$player['createTime'] = date('Y-m-d H:i:s', $player['createTime'] / 1000);
$player['loginTime'] = date('Y-m-d H:i:s', $player['loginTime'] / 1000);
$player['onLineTime'] = gmstrftime('%H:%M:%S', $player['onLineTime'] / 1000);
}
$this->_loadCore('Help_Page');
//载入分页工具
$helpPage = new Help_Page(array('total' => $data['data']['total'], 'perpage' => PAGE_SIZE));
$this->_assign['dataList'] = $data['data']['list'];
$this->_assign['pageBox'] = $helpPage->show();
}
} else {
$this->_assign['connectError'] = 'Error Message:' . $data['info'];
}
if ($this->_isAjax()) {
$this->ajaxReturn(array('status' => $data['status'], 'info' => $data['info'], 'data' => $this->_assign));
}
return $this->_assign;
}
示例13: bceTimeNow
/**
* @param number $bos_time The default value is 0, most of time this paramter
* only used in test cases.
*
* @return string
*/
static function bceTimeNow($bos_time = 0)
{
if ($bos_time > 0) {
return gmstrftime("%Y-%m-%dT%H:%M:%SZ", $bos_time);
}
return gmstrftime("%Y-%m-%dT%H:%M:%SZ", time());
}
示例14: index
public function index()
{
switch ($_GET['ext']) {
case 'js':
$this->mimetype = 'application/x-javascript';
break;
case 'rss':
$this->mimetype = 'application/rss+xml';
break;
case 'xml':
$this->mimetype = 'text/xml';
break;
case 'css':
$this->mimetype = 'text/css';
break;
default:
$this->mimetype = 'text/plain';
}
$asset_file = dirname(__FILE__) . '/../assets/' . $_GET['dir'] . '/' . $_GET['file'] . '.' . $_GET['ext'];
$this->response->body = file_get_contents($asset_file);
$this->response->add_header('Content-Type', $this->mimetype);
$this->response->add_header('Cache-Control', 'max-age=86400');
$this->response->add_header('Pragma', 'max-age=86400');
$this->response->add_header('Last-Modified', gmstrftime('%a, %d %b %Y %H:%M:%S %Z', filemtime($asset_file)));
$this->response->add_header('Date', gmstrftime('%a, %d %b %Y %H:%M:%S %Z'));
$this->response->add_header('Expires', gmstrftime('%a, %d %b %Y %H:%M:%S %Z', time() + 86400));
$this->render(NULL);
}
示例15: timestamp_to_datetime
static function timestamp_to_datetime($t = NULL)
{
if ($t === NULL) {
$t = time();
}
return gmstrftime('%Y%m%dT%H%M%SZ', $t);
}