本文整理匯總了PHP中Manager::date方法的典型用法代碼示例。如果您正苦於以下問題:PHP Manager::date方法的具體用法?PHP Manager::date怎麽用?PHP Manager::date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Manager
的用法示例。
在下文中一共展示了Manager::date方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: colorData
static function colorData($value)
{
$control = new MLabel($value);
$date = Manager::date($value);
$color = $date->compare('>', '01/10/2011') ? 'blue' : 'red';
$control->addStyle('color', $color);
return $control;
}
示例2: dates
public function dates()
{
// Create a MDate object
$date = Manager::date('01/07/2011');
// Show formatted
$this->data->baseDate = "Data base para o exemplo: " . $date->format();
// Clonning
$newDate = $date->copy();
$this->data->cloneDate = "Clone da data base: " . $newDate->format();
// Adding interval
$date->add('P2D');
$this->data->addDate = "Adicionando 2 dias: " . $date->format();
// Subtracting interval
$date->sub('P5D');
$this->data->subDate = "Subtraindo 5 dias: " . $date->format();
// Difference between dates
$diff = $date->diff('23/07/2011');
$this->data->diffDate1 = "Diferença entre " . $date->format() . ' e 23/07/2011 = ' . $diff . ' dias';
$diff = $date->diff('13/10/2011', '%m meses e %d dias');
$this->data->diffDate2 = "Diferença entre " . $date->format() . ' e 13/10/2011 = ' . $diff;
// Comparing dates
$date = Manager::date('01/07/2011');
$compare = $date->compare('>', '15/06/2011');
$this->data->compDate1 = $date . ' > 15/06/2011 ? ' . ($compare ? 'SIM' : 'NÃO');
$compare = $date->compare('=', '01/07/2011');
$this->data->compDate2 = $date . ' = 01/07/2011 ? ' . ($compare ? 'SIM' : 'NÃO');
$compare = $date->compare('<', '01/07/2011');
$this->data->compDate3 = $date . ' < 01/07/2011 ? ' . ($compare ? 'SIM' : 'NÃO');
// generic get
$date = Manager::date('01/07/2011');
$this->data->getDay = "getDay = " . $date->getDay();
$this->data->getMonth = "getMonth = " . $date->getMonth();
$this->data->getYear = "getYear = " . $date->getYear();
$this->data->getDayNick = "getDayNick = " . $date->getDayNick();
$this->data->getMonthNick = "getMonthNick = " . $date->getMonthNick();
$this->data->getYear = "getYear = " . $date->getYear('y');
$this->data->getDayName = "getDayName = " . $date->getDayName();
$this->data->getMonthName = "getMonthName = " . $date->getMonthName();
$this->data->getFullName = "getFullName = " . $date->getFullName();
$this->data->getFullNameTrue = "getFullName(true) = " . $date->getFullName(true);
// Invert date
$this->data->invertDate = "Data invertida = " . $date->invert();
// Using DatePeriod
$period = $date->getPeriod('15/07/2011', 'P1D', '23/07/2011');
$this->data->periodoTitulo1 = "Períodos de 1 dia entre 15/07/2011 e 23/07/2011:";
foreach ($period as $dt) {
$this->data->periodo1 .= \Manager::date($dt) . ' - ';
}
$period = $date->getPeriod('01/01/2011', 'P14D', '23/07/2011');
$this->data->periodoTitulo2 = "Períodos de 14 dias entre 01/01/2011 e 23/07/2011:";
foreach ($period as $dt) {
$this->data->periodo2 .= \Manager::date($dt) . ' - ';
}
$this->render();
}
示例3: formTextField
public function formTextField()
{
$this->data->email = 'a@teste.com';
$this->data->nomeValidator = false;
$this->data->currency = Manager::currency(1234.56);
$this->data->dataNascimento = Manager::date(Manager::getSysDate());
$this->data->timestamp = Manager::timestamp(Manager::getSysTime());
$this->render();
}
示例4: criteriaMethod01
/**
* Query with automatic join and expressions.
* @return <type>
*/
public function criteriaMethod01()
{
$criteria = $this->getCriteria()->select("*, (pessoa.nome || ' ' || pessoa.email) as nome")->where('pessoa.idPessoa = 1')->and_("pessoa.dataNascimento", ">", \Manager::date('01/01/1976'))->orderBy('pessoa.nome');
return $criteria;
}