本文整理汇总了PHP中Zend_Date::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::get方法的具体用法?PHP Zend_Date::get怎么用?PHP Zend_Date::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setValue
/**
* Sets the internal value to ISO date format.
*
* @param string|array $val String expects an ISO date format. Array notation with 'date' and 'time'
* keys can contain localized strings. If the 'dmyfields' option is used for {@link DateField},
* the 'date' value may contain array notation was well (see {@link DateField->setValue()}).
*/
function setValue($val)
{
if (empty($val)) {
$this->dateField->setValue(null);
$this->timeField->setValue(null);
} else {
// String setting is only possible from the database, so we don't allow anything but ISO format
if (is_string($val) && Zend_Date::isDate($val, $this->getConfig('datavalueformat'), $this->locale)) {
// split up in date and time string values.
$valueObj = new Zend_Date($val, $this->getConfig('datavalueformat'), $this->locale);
// set date either as array, or as string
if ($this->dateField->getConfig('dmyfields')) {
$this->dateField->setValue($valueObj->toArray());
} else {
$this->dateField->setValue($valueObj->get($this->dateField->getConfig('dateformat')));
}
// set time
$this->timeField->setValue($valueObj->get($this->timeField->getConfig('timeformat')));
} elseif (is_array($val) && array_key_exists('date', $val) && array_key_exists('time', $val)) {
$this->dateField->setValue($val['date']);
$this->timeField->setValue($val['time']);
} else {
$this->dateField->setValue($val);
$this->timeField->setValue($val);
}
}
}
示例2: _initView
protected function _initView()
{
$theme = 'default';
$templatePath = APPLICATION_PATH . '/../public/themes/' . $theme . '/templates';
Zend_Registry::set('user_date_format', 'm-d-Y');
Zend_Registry::set('calendar_date_format', 'mm-dd-yy');
Zend_Registry::set('db_date_format', 'Y-m-d');
Zend_Registry::set('perpage', 10);
Zend_Registry::set('menu', 'home');
Zend_Registry::set('eventid', '');
$dir_name = $_SERVER['DOCUMENT_ROOT'] . rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), '/');
Zend_Registry::set('acess_file_path', $dir_name . SEPARATOR . "application" . SEPARATOR . "modules" . SEPARATOR . "default" . SEPARATOR . "plugins" . SEPARATOR . "AccessControl.php");
Zend_Registry::set('siteconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "site_constants.php");
Zend_Registry::set('emailconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "email_constants.php");
Zend_Registry::set('emptab_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "emptabconfigure.php");
Zend_Registry::set('emailconfig_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "mail_settings_constants.php");
Zend_Registry::set('application_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "application_constants.php");
$date = new Zend_Date();
Zend_Registry::set('currentdate', $date->get('yyyy-MM-dd HH:mm:ss'));
Zend_Registry::set('currenttime', $date->get('HH:mm:ss'));
Zend_Registry::set('logo_url', '/public/images/landing_header.jpg');
$view = new Zend_View();
$view->setEscape('stripslashes');
$view->setBasePath($templatePath);
$view->setScriptPath(APPLICATION_PATH);
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $this;
}
示例3: testDateFormatForDatePicker
public function testDateFormatForDatePicker()
{
//Without time
$date = new Zend_Date('1/12/2009', 'dd/MM/YYYY');
$form = new Cms_Form_Model_Flatpage();
$form->setDateFormat('dd/MM/yy');
$row = Centurion_Db::getSingleton('cms/flatpage')->createRow();
$row->published_at = $date->get(Centurion_Date::MYSQL_DATETIME);
$form->setInstance($row);
$expected = $date->get('dd/MM/yy');
$value = $form->getElement('published_at')->getValue();
$this->assertEquals($expected, $value);
$values = $form->processValues($form->getValues());
$this->assertEquals($date->get(Centurion_Date::MYSQL_DATETIME), $values['published_at']);
//With Time
$date = new Zend_Date('1/12/2009 11:32', 'dd/MM/YYYY HH:mm');
$form = new Cms_Form_Model_Flatpage();
$form->setDateFormat('dd/MM/yy', 'hh:mm');
$row = Centurion_Db::getSingleton('cms/flatpage')->createRow();
$row->published_at = $date->get(Centurion_Date::MYSQL_DATETIME);
$form->setInstance($row);
$expected = $date->get('dd/MM/yy hh:mm');
$value = $form->getElement('published_at')->getValue();
$this->assertEquals($expected, $value);
$values = $form->processValues($form->getValues());
$this->assertEquals($date->get(Centurion_Date::MYSQL_DATETIME), $values['published_at']);
}
示例4: getAvailableUpdates
/**
* @param null $currentRev
* @return array
* @throws \Exception
*/
public static function getAvailableUpdates($currentRev = null)
{
if (!$currentRev) {
$currentRev = Version::$revision;
}
self::cleanup();
if (PIMCORE_DEVMODE) {
$xmlRaw = Tool::getHttpData("http://" . self::$updateHost . "/v2/getUpdateInfo.php?devmode=1&revision=" . $currentRev);
} else {
$xmlRaw = Tool::getHttpData("http://" . self::$updateHost . "/v2/getUpdateInfo.php?revision=" . $currentRev);
}
$xml = simplexml_load_string($xmlRaw, null, LIBXML_NOCDATA);
$revisions = array();
$releases = array();
if ($xml instanceof \SimpleXMLElement) {
if (isset($xml->revision)) {
foreach ($xml->revision as $r) {
$date = new \Zend_Date($r->date);
if (strlen(strval($r->version)) > 0) {
$releases[] = array("id" => strval($r->id), "date" => strval($r->date), "version" => strval($r->version), "text" => strval($r->id) . " - " . $date->get(\Zend_Date::DATETIME_MEDIUM));
} else {
$revisions[] = array("id" => strval($r->id), "date" => strval($r->date), "text" => strval($r->id) . " - " . $date->get(\Zend_Date::DATETIME_MEDIUM));
}
}
}
} else {
throw new \Exception("Unable to retrieve response from update server. Please ensure that your server is allowed to connect to update.pimcore.org:80");
}
return array("revisions" => $revisions, "releases" => $releases);
}
示例5: convertDateToStoreTimestamp
public function convertDateToStoreTimestamp($date, $store = null)
{
try {
if (Mage::getStoreConfigFlag('xtcore/compatibility_fixes/disable_timestamp_timezone_adjustment')) {
$dateObj = new Zend_Date();
$dateObj->set($date, Varien_Date::DATETIME_INTERNAL_FORMAT);
return (int) $dateObj->get(null, Zend_Date::TIMESTAMP);
}
$dateObj = new Zend_Date();
$dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
$dateObj->set($date, Varien_Date::DATETIME_INTERNAL_FORMAT);
$dateObj->setLocale(Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $store));
$dateObj->setTimezone(Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $store));
$gmtOffset = $dateObj->getGmtOffset();
if ($gmtOffset >= 0) {
if (Mage::getStoreConfigFlag('xtcore/compatibility_fixes/zend_date_gmt_offset')) {
// Note: Some Zend_Date versions always return a positive $gmtOffset. Thus, we replace + with - below if affected by this.
return (int) $dateObj->get(null, Zend_Date::TIMESTAMP) - $gmtOffset;
} else {
return (int) $dateObj->get(null, Zend_Date::TIMESTAMP) + $gmtOffset;
}
} else {
return (int) $dateObj->get(null, Zend_Date::TIMESTAMP) - $gmtOffset;
}
} catch (Exception $e) {
return null;
}
}
示例6: indexAction
public function indexAction()
{
// numero da semana anterior
$zendDate = new Zend_Date();
$semana = $zendDate->get(Zend_Date::WEEK) - 1;
$dia_semana = $zendDate->get(Zend_Date::WEEKDAY_DIGIT);
$zendDate->subDay(7);
$dia_semana_inicio = $dia_semana - 1;
$dia_semana_fim = 7 - $dia_semana;
$periodo_inicial = $zendDate->subDay($dia_semana_inicio)->get("dd/MM/YYYY");
$periodo_final = $zendDate->addDay($dia_semana_fim)->get('dd/MM/YYYY');
$periodo = $periodo_inicial . ' à ' . $periodo_final;
// busca as visualizacoes da semana
$modelSalaoVisualizacao = new Model_DbTable_SalaoVisualizacao();
$visualizacoes = $modelSalaoVisualizacao->visualizacoes($semana);
try {
foreach ($visualizacoes as $visualizacao) {
$pluginMail = new Plugin_Mail();
$pluginMail->setDataMail('visualizacao', $visualizacao);
$pluginMail->setDataMail('periodo', $periodo);
$pluginMail->send("salao-visualizacao.phtml", "Relatório de Visualizações", $visualizacao->salao_email);
}
echo 'emails enviados';
} catch (Zend_Mail_Exception $ex) {
die('email');
} catch (Exception $ex) {
Zend_Debug::dump($ex->getMessage());
}
}
示例7: date
public static function date($date, $length = "", $locale = "")
{
global $config;
$locale == "" ? $locale = new Zend_Locale($config->local->locale) : ($locale = $locale);
$length == "" ? $length = "medium" : ($lenght = $length);
/*
* Length can be any of the Zend_Date lenghts - FULL, LONG, MEDIUM, SHORT
*/
$formatted_date = new Zend_Date($date, 'yyyy-MM-dd');
switch ($length) {
case "full":
return $formatted_date->get(Zend_Date::DATE_FULL, $locale);
break;
case "long":
return $formatted_date->get(Zend_Date::DATE_LONG, $locale);
break;
case "medium":
return $formatted_date->get(Zend_Date::DATE_MEDIUM, $locale);
break;
case "short":
return $formatted_date->get(Zend_Date::DATE_SHORT, $locale);
break;
default:
return $formatted_date->get(Zend_Date::DATE_SHORT, $locale);
}
}
示例8: getDataForResource
/**
* @see Document_Tag::getDataForResource
* @return void
*/
public function getDataForResource()
{
$this->sanityCheck();
if ($this->date instanceof Zend_Date) {
return $this->date->get(Zend_Date::TIMESTAMP);
}
return;
}
示例9: getDataForResource
/**
* @see Document\Tag::getDataForResource
* @return void
*/
public function getDataForResource()
{
$this->checkValidity();
if ($this->date instanceof \Zend_Date) {
return $this->date->get(\Zend_Date::TIMESTAMP);
}
return;
}
示例10: getLogByDay
/**
* this function returns the unique hits for the current week by the day
*
* @return zend_db_rowset
*/
public function getLogByDay()
{
$date = new Zend_Date();
$week = $date->get(Zend_Date::WEEK);
$year = $date->get(Zend_Date::YEAR);
$sql = "SELECT\r\n COUNT(id) AS unique_hits,\r\n traffic_log.day\r\n FROM\r\n traffic_log\r\n WHERE\r\n week = {$week}\r\n AND\r\n year = {$year}\r\n AND\r\n page NOT LIKE '/admin%'\r\n AND\r\n page NOT LIKE '/module%'\r\n GROUP BY\r\n traffic_log.`year`,\r\n traffic_log.`day`,\r\n traffic_log.`ip`\r\n ORDER BY\r\n year DESC, day DESC\r\n ";
return $this->_db->fetchAll($sql);
}
示例11: setUp
/**
* Initialization.
* @see PHPUnit_Framework_TestCase::setUp()
*/
protected function setUp() {
$this->requested_at = new Zend_Date();
$this->received_at = new Zend_Date();
$this->received_at->addDay(14)->addHour(1)->addMinute(15);
$this->history = new Blipoteka_Book_History();
$this->history->borrower_id = 1;
$this->history->lender_id = 2;
$this->history->book_id = 1;
$this->history->requested_at = $this->requested_at->get(Zend_Date::W3C);
$this->history->received_at = $this->received_at->get(Zend_Date::W3C);
}
示例12: data
function data($timestamp, $format = Zend_Date::DATE_LONG, $idioma = 'pt_BR')
{
$date = new Zend_Date($timestamp, $idioma);
if ($format == "ESPECIAL") {
if (!$date->compareDate(date("d-m-Y"))) {
return "Hoje, " . $date->get(Zend_Date::TIME_SHORT);
} else {
return date("d/m", $date->get()) . " - " . $date->get(Zend_Date::TIME_SHORT);
}
}
return $date->get($format);
}
示例13: datformat
/**
*
*/
public function datformat($input, $format = 'short')
{
$vDate = new Zend_Date($input);
if ($format == 'short') {
return $vDate->get(Zend_Date::DATE_MEDIUM);
} elseif ($format == 'long') {
return $vDate->get(Zend_Date::DATE_LONG);
} elseif ($format == 'timeshort') {
return $vDate->get(Zend_Date::DATETIME_SHORT);
} elseif ($format == 'timelong') {
return $vDate->get(Zend_Date::DATETIME_LONG);
}
}
示例14: date
/**
* @param string $date
* @return Sgca_View_Helper_Date provides a fluent interface
*/
public function date($date = null, $part = 'yyyy-MM-dd', $output = 'dd/MM/yyyy')
{
if ($date instanceof Zend_Date) {
return $date->get($output);
}
if (null !== $date && null !== $part) {
$this->setDate(new Zend_Date($date, $part));
}
if (null !== $output && null !== $date) {
return $this->_date->get($output);
}
return $this;
}
示例15: getCheckoutFormFields
/**
* getCheckoutFormFields
*
* Gera os campos para o formulário de redirecionamento ao Banco do Brasil
*
* @return array
*/
public function getCheckoutFormFields($order_id, $tpPagamento)
{
$order = $this->getOrder($order_id);
$pedido = $order->getData();
// order details
$customer_id = $order->getCustomerId();
$customerData = Mage::getModel('customer/customer')->load($customer_id);
// then load customer by customer id
$cliente = $customerData->getData();
// customer details
$date = new Zend_Date();
$dataNascimento = new Zend_Date($cliente['dob'], 'YYYY-MM-dd HH:mm:ss');
// Utiliza endereço de cobrança caso produto seja virtual/para download
$address = $order->getIsVirtual() ? $order->getBillingAddress() : $order->getShippingAddress();
$numCliente = $this->getConfigData('numCliente', $order->getStoreId());
$coopCartao = $this->getConfigData('coopCartao', $order->getStoreId());
$chaveAcessoWeb = $this->getConfigData('chaveAcessoWeb', $order->getStoreId());
$codMunicipio = $this->getConfigData('codMunicipio', $order->getStoreId());
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
$region = $_read->fetchRow('SELECT * FROM ' . Mage::getConfig()->getTablePrefix() . 'directory_country_region WHERE default_name = "' . $address->getRegion() . '"');
$telefoneCompleto = $this->limpaTelefone($cliente['telefone']);
$dd = $telefoneCompleto[0] . $telefoneCompleto[1];
$telefone = str_replace($dd, "", $telefoneCompleto);
// Monta os dados para o formulário
$fields = array('numCliente' => $numCliente, 'coopCartao' => $coopCartao, 'chaveAcessoWeb' => $chaveAcessoWeb, 'numContaCorrente' => '', 'codMunicipio' => '', 'nomeSacado' => $address->getFirstname() . ' ' . $address->getLastname(), 'dataNascimento' => $dataNascimento->get('YYYYMMdd'), 'cpfCGC' => str_replace(".", "", $cliente['cpf']), 'endereco' => $address->getStreet1() . ', ' . $address->getStreet2(), 'bairro' => $address->getStreet3(), 'cidade' => $address->getCity(), 'cep' => str_replace('-', '', $address->getPostcode()), 'uf' => $region['code'], 'telefone' => $telefone, 'ddd' => $dd, 'ramal' => '', 'bolRecebeBoletoEletronico' => 1, 'email' => $cliente['email'], 'codEspDocumento' => 'DM', 'dataEmissao' => date('Ymd'), 'seuNumero' => '', 'nomeSacador' => '', 'numCGCCPFSacador' => '', 'qntMonetaria' => 1, 'valorTitulo' => number_format($order->getGrandTotal(), 2, '.', ','), 'codTipoVencimento' => '1', 'dataVencimentoTit' => date('Ymd', strtotime("+3 day")), 'valorAbatimento' => '0', 'valorIOF' => '0', 'bolAceite' => '1', 'percTaxaMulta' => '0', 'percTaxaMora' => '0', 'dataPrimDesconto' => NULL, 'valorSegDesconto' => NULL, 'descInstrucao1' => 'Pedido #' . $pedido["increment_id"] . '', 'descInstrucao2' => 'Pedido efetuado na loja seu-site.com.br.', 'descInstrucao3' => 'Em 2(dois) dias úteis para confirmação', 'descInstrucao4' => 'Não receber aṕos o vencimento', 'descInstrucao5' => 'Não receber pagamento em cheque');
return $fields;
}