本文整理汇总了PHP中TimeDate::format方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::format方法的具体用法?PHP TimeDate::format怎么用?PHP TimeDate::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::format方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
//.........这里部分代码省略.........
<tr>
<td style="text-align:center;"><?php
echo $jLang['_COM_DASH_COMMENT'];
?>
: <?php
echo $commentArea;
?>
</td>
</tr>
<?php
}
?>
<tr>
<td style='text-align:center' id='submittipsbuttonarea'><?php
echo $disabled != "disabled" ? "<input type='button' class='button' name='submittips' id='submittips' value='" . $jLang['_COM_TIPS_SAVE'] . "' {$checkComment} />" : "";
?>
</td>
</tr>
<tr>
<td style='text-align:center; padding-top:5px; display:none;' id='ajaxloading'></td>
</tr>
</table>
</div>
<input type='hidden' name='round_id' value='<?php
echo $this->jRound->id;
?>
' />
</form>
<?php
} else {
if ($this->jRound->exists() and TimeDate::toDatabaseDateTime($this->jRound->start_time) > gmdate('Y-m-d H:i:s')) {
?>
<h2 style='text-align:center'><?php
echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
?>
</h2>
<h2 style='text-align:center'><?php
echo $jLang['_COM_ROUND_CLOSED'];
?>
</h2>
<?php
} else {
if ($this->jRound->exists()) {
?>
<h2 style='text-align:center'><?php
echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
?>
</h2>
<?php
} else {
?>
<h2 style='text-align:center'><?php
echo $jLang['_COM_ROUND_NOGAMES'];
?>
</h2>
<?php
}
}
}
if ($this->jRound->getStatus() === false and !empty($jTipsCurrentUser->id)) {
$userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false);
$targetTime = date('Y-m-d H:i:s', $userTime);
if ($jTips['ShowJSCountdown'] == 1) {
$field = "'countdown'";
} else {
$field = "false";
}
?>
<script type='text/javascript'>
window.addEvent('domready', function(){
var year = <?php
echo TimeDate::format($targetTime, '%Y', true, false);
?>
;
var month = <?php
echo TimeDate::format($targetTime, '%m', true, false) - 1;
?>
;
var day = <?php
echo TimeDate::format($targetTime, '%d', true, false);
?>
;
var hour = <?php
echo TimeDate::format($targetTime, '%H', true, false);
?>
;
var min = <?php
echo TimeDate::format($targetTime, '%M', true, false);
?>
;
var sec = 0;
jTipsCountdown(year, month, day, hour, min, 1, <?php
echo $field;
?>
);
});
</script>
<?php
}
}
示例2: gmdate
$tpl->date_start_time_meridiem = jTipsHTML::selectList($meridiemOptions, 'date_start_time_meridiem', "class='inputbox'", 'value', 'text', $date_start_time_meridiem);
}
//now prepare the end_time
if (!$focus->end_time) {
$focus->end_time = gmdate('Y-m-d H:i:s');
}
//BUG 263
if (!isJoomla15()) {
$tpl->date_end_date = TimeDate::toDisplayDate($focus->end_time, true);
$tpl->date_end_date = TimeDate::toDatabaseDate($tpl->date_end_date);
} else {
$tpl->date_end_date = TimeDate::toDisplayDate($focus->end_time, true);
}
$date_end_time_hour = TimeDate::format($focus->end_time, '%I', true);
$date_end_time_minute = TimeDate::format($focus->end_time, '%M', true);
$date_end_time_meridiem = strtolower(TimeDate::format($focus->end_time, '%p', true));
// BUG 326 - Optionally allo 24-hour format
if (intval($jTips['Is24Hour']) == 1) {
$hour_end = 23;
if ($date_end_time_meridiem == 'pm') {
$date_end_time_hour += 12;
}
} else {
$hour_end = 12;
}
$tpl->date_end_time_hour = jTipsHTML::integerSelectList(1, $hour_end, 1, 'date_end_time_hour', "class='inputbox'", $date_end_time_hour);
$tpl->date_end_time_minute = jTipsHTML::integerSelectList('00', $end, $step, 'date_end_time_minute', "class='inputbox'", $date_end_time_minute);
if (intval($jTips['Is24Hour']) == 1) {
$tpl->date_end_time_meridiem = '';
} else {
$tpl->date_end_time_meridiem = jTipsHTML::selectList($meridiemOptions, 'date_end_time_meridiem', "class='inputbox'", 'value', 'text', $date_end_time_meridiem);
示例3: display
//.........这里部分代码省略.........
echo $tags;
?>
><?php
echo $jGame->{$left_score_field} . " - " . $jGame->{$right_score_field};
?>
</th>
<?php
}
?>
<td><?php
if (!empty($jGame->description)) {
$description = nl2br(stripslashes($jGame->description));
echo jTipsToolTip($description, $jLang['_COM_GAME_ADDITIONAL_INFO']);
} else {
echo " ";
}
?>
</td>
</tr>
<?php
$rowIndex++;
}
?>
</table>
<div><?php
$this->renderByes();
?>
</div>
<?php
} else {
if ($this->jRound->exists() and TimeDate::toDatabaseDateTime($this->jRound->start_time) > gmdate('Y-m-d H:i:s')) {
?>
<h2 style='text-align: center'><?php
echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
?>
</h2>
<h2 style='text-align: center'><?php
echo $jLang['_COM_ROUND_CLOSED'];
?>
</h2>
<?php
} else {
if ($this->jRound->exists()) {
?>
<h2 style='text-align: center'><?php
echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round;
?>
</h2>
<?php
} else {
?>
<h2 style='text-align: center'><?php
echo $jLang['_COM_ROUND_NOGAMES'];
?>
</h2>
<?php
}
}
}
if ($this->jRound->getStatus() === false) {
$userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false);
$targetTime = date('Y-m-d H:i:s', $userTime);
if ($jTips['ShowJSCountdown'] == 1) {
$field = "'countdown'";
} else {
$field = "false";
}
?>
<script type='text/javascript'>
window.addEvent('domready', function(){
var year = <?php
echo TimeDate::format($targetTime, '%Y', true, false);
?>
;
var month = <?php
echo TimeDate::format($targetTime, '%m', true, false) - 1;
?>
;
var day = <?php
echo TimeDate::format($targetTime, '%d', true, false);
?>
;
var hour = <?php
echo TimeDate::format($targetTime, '%H', true, false);
?>
;
var min = <?php
echo TimeDate::format($targetTime, '%M', true, false);
?>
;
var sec = 0;
jTipsCountdown(year, month, day, hour, min, 1, <?php
echo $field;
?>
);
});
</script>
<?php
}
}
示例4: getTimestamp
/**
* Get the timestamp of the match
*
* @param string $format The date format. Leave blank if you want a relative time (e.g. 2 days ago)
*
* @return string The match's timestamp
*/
public function getTimestamp($format = "")
{
if (empty($format)) {
return $this->timestamp->diffForHumans();
}
return $this->timestamp->format($format);
}
示例5: getMapListField
/**
* Récupère la liste des maps sur le serveur et retourne un champ en particulier
*
* @global resource $client -> Le client doit être initialisé
* @return array
*/
public static function getMapListField($field)
{
global $client;
$out = array();
// Méthodes
if (SERVER_VERSION_NAME == 'TmForever') {
$queryName = array('mapList' => 'GetChallengeList');
} else {
$queryName = array('mapList' => 'GetMapList');
}
// Mapslist
if (!$client->query($queryName['mapList'], AdminServConfig::LIMIT_MAPS_LIST, 0)) {
$out['error'] = Utils::t('Client not initialized');
} else {
$mapList = $client->getResponse();
$countMapList = count($mapList);
if ($countMapList > 0) {
$i = 0;
foreach ($mapList as $map) {
switch ($field) {
case 'Name':
$name = htmlspecialchars($map['Name'], ENT_QUOTES, 'UTF-8');
$out[] = TmNick::toHtml($name, 10, true);
break;
case 'Environment':
$env = $map['Environnement'];
if ($env == 'Speed') {
$env = 'Desert';
} else {
if ($env == 'Alpine') {
$env = 'Snow';
}
}
$out[] = $env;
break;
case 'UId':
$out[] = $map['UId'];
break;
case 'FileName':
$out[] = $map['FileName'];
break;
case 'Author':
$out[] = $map['Author'];
break;
case 'GoldTime':
$out[] = TimeDate::format($map['GoldTime']);
break;
case 'CopperPrice':
$out[] = $map['CopperPrice'];
break;
case 'MapType':
$out[] = $map['MapType'];
break;
case 'MapStyle':
$out[] = $map['MapStyle'];
break;
}
$i++;
}
}
}
return $out;
}
示例6:
?>
;
var month = <?php
echo TimeDate::format($targetTime, '%m', true, false) - 1;
?>
;
var day = <?php
echo TimeDate::format($targetTime, '%d', true, false);
?>
;
var hour = <?php
echo TimeDate::format($targetTime, '%H', true, false);
?>
;
var min = <?php
echo TimeDate::format($targetTime, '%M', true, false);
?>
;
var sec = 0;
jTipsCountdown(year, month, day, hour, min, 1, "counter<?php
echo $randId;
?>
", true);
});
</script>
<?php
}
}
}
?>
示例7: getCreationDateFormat
/**
* Get the creation date for the team in a specified format
*
* @param string $format The format of the data
*
* @return string
*/
public function getCreationDateFormat($format = "Y-m-d")
{
return $this->created->format($format);
}
示例8: __invoke
/**
* @param \TimeDate $time The TimeDate object we'll be representing as text
* @param string $format The format that will be shown. If a format isn't set, it'll return the difference in human readable time
*
* @return string
*/
public function __invoke($time, $format = "")
{
$timeElement = '<span class="c-timestamp js-timestamp" title="%s">%s</span>';
$outputTime = empty($format) ? $time->diffForHumans() : $time->format($format);
return sprintf($timeElement, $time->format("F j, Y g:ia"), $outputTime);
}
示例9: parseEditField
function parseEditField($def)
{
global $jTips;
if (isset($def['attributes']) and !empty($def['attributes'])) {
$attribs = array();
foreach ($def['attributes'] as $name => $value) {
// BUG 393 - values with quotes cause invalid HTML
$attribs[] = "{$name}=\"" . str_replace('"', "'", jTipsStripslashes($value)) . "\"";
}
$attributes = implode(" ", $attribs);
} else {
$attributes = '';
}
switch ($def['type']) {
case 'label':
$html = "<span class='help'>" . $def['attributes']['value'] . "</span>";
break;
case 'select':
$html = jTipsHTML::selectList($def['options'], $def['attributes']['name'], $attributes, 'value', 'text', $def['selected']);
break;
case 'date':
//BUG 263 - Date fields in J1.0 must be in YYYY-MM-DD format
if (!isJoomla15()) {
$def['attributes']['value'] = TimeDate::format($def['attributes']['value'], '%Y-%m-%d');
$attributes = preg_replace("/value='[^']*'/i", "value='" . $def['attributes']['value'] . "'", $attributes);
}
$html = "<input {$attributes} /> <img src='components/com_jtips/images/calendar.png' onclick='return showCalendar(\"{$def['attributes']['name']}\", \"{$jTips['DateFormat']}\");' border='0' alt='...' align='absmiddle' />";
break;
case 'bool':
$html = jTipsHTML::yesnoRadioList($def['attributes']['name'], $attributes, $def['selected']);
break;
case 'img':
$html = "<img {$attributes} />";
break;
case 'textarea':
$html = "<textarea {$attributes}>" . jTipsStripslashes($def['text']) . "</textarea>";
break;
case 'editor':
jTipsInitEditor();
jTipsEditorArea($def['attributes']['name'], jTipsStripslashes($def['attributes']['value']), $def['attributes']['name'], '100%', '300px', 100, 25);
jTipsHTML::keepAlive();
return '';
break;
default:
if (jTipsGetParam($def['attributes'], 'value')) {
$def['attributes']['value'] = jTipsStripslashes($def['attributes']['value']);
}
$html = "<input {$attributes} />";
break;
}
return $html;
}
示例10: getJoinedDate
/**
* Get the joined date of the player
*
* @param string $format
*
* @return string The joined date of the player
*/
public function getJoinedDate($format = "")
{
$this->lazyLoad();
if (empty($format)) {
return $this->joined->diffForHumans();
}
return $this->joined->format($format);
}