本文整理汇总了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;
}