当前位置: 首页>>代码示例>>PHP>>正文


PHP Time::setToStringFormat方法代码示例

本文整理汇总了PHP中Cake\I18n\Time::setToStringFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::setToStringFormat方法的具体用法?PHP Time::setToStringFormat怎么用?PHP Time::setToStringFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\I18n\Time的用法示例。


在下文中一共展示了Time::setToStringFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     Time::setToStringFormat('yyyy-MM-dd HH:mm:ss');
     $this->request = new Request();
     $this->response = new Response();
     $this->view = new CsvView($this->request, $this->response);
 }
开发者ID:AlexandreSGV,项目名称:siteentec,代码行数:7,代码来源:CsvViewTest.php

示例2: beforeFilter

 public function beforeFilter(Event $event)
 {
     parent::beforeFilter($event);
     Time::$defaultLocale = 'en-CA';
     Time::setToStringFormat('YYYY-MM-dd');
     $this->Session = $this->request->session();
     $this->set('Session', $this->Session);
     $this->_icons = $this->Utilities->setIcons();
     $this->set('icons', $this->_icons);
     $title = $this->Utilities->setDefaultTitle();
     $breadcrumbs = $this->Utilities->setDefaultBreadcrumbs();
     $this->set(compact('title', 'breadcrumbs'));
     if (empty($this->request->params['prefix'])) {
         $this->Auth->allow();
         $this->viewBuilder()->layout('public');
     }
     // Set the user logged in
     if (!is_null($this->Auth->user('id'))) {
         $Users = TableRegistry::get('Users');
         $this->_user = $Users->get($this->Auth->user('id'));
         $this->set('authUser', $this->_user);
     } else {
         $this->set('authUser', false);
     }
     // $this->set(compact($authUser));
     $nav = $this->_setNav();
     $this->set(compact('nav'));
 }
开发者ID:BreakfastMonkey,项目名称:breakfast-combo,代码行数:28,代码来源:AppController.php

示例3: beforeFilter

 public function beforeFilter(Event $event)
 {
     parent::beforeFilter($event);
     $session = $this->request->session();
     $lang = 'en';
     if (isset($this->request->params['lang'])) {
         $lang = $this->request->params['lang'];
     } else {
         if ($session->check('Config.language')) {
             $lang = $session->read('Config.language');
         }
     }
     $session->write('Config.language', $lang);
     // Change current language by post request
     if ($this->request->is('post') && isset($this->request->data['language'])) {
         $newLang = $this->request->data['language'];
         $transUrl = $this->translateUrl($newLang);
         $this->redirect($transUrl);
     }
     $this->set('lang', $lang);
     $this->set('controller', $this->name);
     I18n::locale($lang);
     Time::setToStringFormat('YYYY-MM-dd HH:mm:ss');
     Type::build('datetime')->useLocaleParser();
     $this->Auth->config(['unauthorizedRedirect' => false]);
     $this->Auth->allow(['login', 'init']);
     $user = $this->Auth->user();
     if (isset($user)) {
         $username = $user['username'];
         $this->set(['is_authorized' => true, 'username' => $username]);
     } else {
         $this->set('is_authorized', false);
     }
 }
开发者ID:GreeNoir,项目名称:game-wizard,代码行数:34,代码来源:AppController.php

示例4: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('Flash');
     $this->loadComponent('Paginator');
     Time::$defaultLocale = 'es-ES';
     Time::setToStringFormat('dd-MM-YYYY HH:mm');
 }
开发者ID:aguiluxo,项目名称:iestrascolar,代码行数:15,代码来源:AppController.php

示例5: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     $this->loadComponent('Flash');
     $this->loadComponent('RequestHandler');
     // added in line to format date correctly
     Time::$defaultLocale = 'en-AU';
     Time::setToStringFormat('dd/MM/YYYY');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginRedirect' => ['controller' => 'pages', 'action' => 'home'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home']]);
 }
开发者ID:kfer10,项目名称:excel,代码行数:18,代码来源:AppController.php

示例6: beforeRender

 /**
  * Before render callback.
  *
  * @param \Cake\Event\Event $event The beforeRender event.
  * @return void
  */
 public function beforeRender(Event $event)
 {
     if (!array_key_exists('_serialize', $this->viewVars) && in_array($this->response->type(), ['application/json', 'application/xml'])) {
         $this->set('_serialize', true);
     }
     Time::setToStringFormat('dd/MM/yy, HH:MM');
     Time::setJsonEncodeFormat('dd/MM/yy, HH:MM');
     $this->set('renderLayoutTitle', $this->renderLayoutTitle);
     $this->set('userLoggedIn', $this->Auth->user());
 }
开发者ID:benscobie,项目名称:webaudit-website,代码行数:16,代码来源:AppController.php

示例7: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     //Time::$defaultLocale = 'es-ES';
     Time::setToStringFormat('dd-MM-YYYY');
     $this->set('myTemplates', Configure::read('Templates'));
     $this->primerRecibo = Configure::read('primerRecibo');
     $this->set('primerRecibo', $this->primerRecibo);
     $this->loadComponent('Flash');
 }
开发者ID:ElWray,项目名称:JCMv2,代码行数:17,代码来源:AppController.php

示例8: _getNextTurn

 protected function _getNextTurn()
 {
     if ($this->hostinterval != 0) {
         Time::setToStringFormat('yyyy-MM-dd HH:mm:ss');
         $clone = clone $this->lastturn;
         return $clone->addMinutes($this->hostinterval);
     } else {
         if ($this->hour != 0) {
             return false;
         }
     }
     return false;
 }
开发者ID:Moggers,项目名称:blitzserver,代码行数:13,代码来源:Match.php

示例9: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     Time::setToStringFormat('YYYY-MM-dd HH:mm:ss');
     $this->loadComponent('Csrf');
     $this->loadComponent('RequestHandler');
     //for json data
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['fields' => ['username' => 'username', 'password' => 'password']]], 'loginAction' => ['controller' => 'Users', 'action' => 'login']]);
     // Allow the display action so our pages controller
     // continues to work. We don't actually use the pages controller
     //so disable this for now
     //$this->Auth->allow(['display']);
 }
开发者ID:robisacommonusername,项目名称:rran-site,代码行数:21,代码来源:AppController.php

示例10: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     //configure the date to australian format globally .
     Time::setToStringFormat('dd/MM/YYYY');
     Configure::write('orderRecievedEmail', 'solemate.doormats@gmail.com');
     //set up the AUTH componant to facilitate login.
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['fields' => ['username' => 'username', 'password' => 'password']]], 'loginAction' => ['controller' => 'Users', 'action' => 'login'], 'loginRedirect' => ['controller' => 'Users', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home']]);
     // Allow the display action so our pages controller
     // continues to work.
     $this->Auth->allow(['display']);
     //set the user role in the session for security check later on.
     $session = $this->request->session();
     $session->write('userRole', $this->Auth->user('role'));
     //this loads the nice tooltip messages for errors, confirms etc.
     $this->loadComponent('Flash');
     $this->loadComponent('Cookie', ['expiry' => '+2 days']);
 }
开发者ID:eddiePower,项目名称:cakephp,代码行数:25,代码来源:AppController.php

示例11: beforeRender

 /**
  * Before render callback.
  *
  * @param \Cake\Event\Event $event The beforeRender event.
  * @return void
  */
 public function beforeRender(Event $event)
 {
     Time::setToStringFormat('dd/MM/YYYY');
     if (!array_key_exists('_serialize', $this->viewVars) && in_array($this->response->type(), ['application/json', 'application/xml'])) {
         $this->set('_serialize', true);
     }
     $login = $this->request->session()->read("Auth.User.username");
     $foto = $this->request->session()->read("Auth.User.foto");
     $this->set('fotoUsuario', $foto);
     $this->set('login', $login);
     $this->loadModel('Logs');
     $logs = $this->Logs->find('all', ['fields' => ['Logs.id', 'Logs.descricao', 'Acao.nome', 'Acao.icone'], 'order' => ['Logs.id' => 'desc'], 'join' => [['table' => 'acoes', 'alias' => 'Acao', 'type' => 'INNER', 'conditions' => ['Acao.id = Logs.acao_id']]], 'limit' => 4])->toArray();
     $this->set('logs', $logs);
     $this->loadModel('Metas');
     $progresso_metas = $this->Metas->find('all', ['fields' => ['nome' => 'Metas.nome', 'percentual' => '(SUM(Lancamentos.valor) * 100 / Metas.vl_meta)', 'Metas.tp_controle'], 'order' => ['Metas.nome' => 'asc'], 'join' => [['table' => 'lancamentos', 'alias' => 'Lancamentos', 'type' => 'INNER', 'conditions' => ['Lancamentos.categoria_id = Metas.categoria_id']]], 'conditions' => ['Lancamentos.dt_cadastro BETWEEN Metas.dt_inicial and Metas.dt_final'], 'group' => ['Lancamentos.categoria_id']])->toArray();
     $this->set('progresso_metas', $progresso_metas);
     // Contas a pagar e contas a receber
     $this->loadModel('Lancamentos');
     $dtCadastro = new \DateTime('now');
     $lancamentos = $this->Lancamentos->find('all', ['fields' => ['Lancamentos.descricao', 'Lancamentos.valor'], 'order' => ['Lancamentos.data' => 'asc'], 'conditions' => ['Lancamentos.data >=' => new \DateTime('now'), 'Lancamentos.data <=' => $dtCadastro->modify('+30 days'), 'Lancamentos.consolidado' => 'N']])->toArray();
     $this->set('lancamentos', $lancamentos);
 }
开发者ID:QuielSimoes,项目名称:meugarangau,代码行数:28,代码来源:AppController.php

示例12: scheduleFutureJobs

 public function scheduleFutureJobs($ignoreId = null)
 {
     Time::setToStringFormat('y-MM-dd HH:mm:ss');
     $thisTaskName = preg_replace('/^Queue/', '', $this->name);
     $existingJobsQuery = $this->QueuedTasks->find()->where(['jobtype' => $thisTaskName]);
     $existingJobs = [];
     foreach ($existingJobsQuery as $job) {
         $existingJobs[(string) $job->notbefore] = $job->id == $ignoreId;
     }
     //All future jobs should run on September 1
     //Scheduling five years out, just because
     $currentYear = intval(date('Y'));
     $now = new Time();
     for ($year = $currentYear; $year <= $currentYear + 5; $year++) {
         $date = new Time("{$year}-09-01");
         if ($date <= $now) {
             //Running this sometime after September 1, so do not
             //re-schedule for the past
             continue;
         }
         //This date is already scheduled
         if (array_key_exists((string) $date, $existingJobs)) {
             $existingJobs[(string) $date] = true;
             continue;
         }
         $this->QueuedTasks->createJob($thisTaskName, null, $date);
     }
     //Clean out any previously-set "future" dates that have been removed
     //(e.g. if "September 1" default date is changed)
     foreach ($existingJobs as $notBefore => $matched) {
         if ($matched) {
             continue;
         }
         $this->QueuedTasks->deleteAll(['notbefore' => $notBefore]);
     }
 }
开发者ID:byu-oit-appdev,项目名称:byusa-clubs,代码行数:36,代码来源:QueueOfficerEligibilityTask.php

示例13: testToString

 /**
  * Tests that __toString uses the i18n formatter
  *
  * @return void
  */
 public function testToString()
 {
     $time = new Time('2014-04-20 22:10');
     Time::$defaultLocale = 'fr-FR';
     Time::setToStringFormat(\IntlDateFormatter::FULL);
     $this->assertTimeFormat('dimanche 20 avril 2014 22:10:00 UTC', (string) $time);
 }
开发者ID:RogerSchmeier,项目名称:Webtruck,代码行数:12,代码来源:TimeTest.php

示例14: index

<?php

namespace App\Controller;

use App\Controller\AppController;
use Cake\I18n\Time;
use Cake\ORM\TableRegistry;
use Cake\Database\Type\DateTimeTyp;
Time::setToStringFormat('YYYY-MM-dd');
/**
 * BrandDiscounts Controller
 *
 * @property \App\Model\Table\BrandDiscountsTable $BrandDiscounts
 */
class BrandDiscountsController extends AppController
{
    /**
     * Index method
     *
     * @return void
     */
    public function index()
    {
        $this->paginate = ['contain' => ['Vendors']];
        $this->set('brandDiscounts', $this->paginate($this->BrandDiscounts));
        $this->set('_serialize', ['brandDiscounts']);
    }
    /**
     * View method
     *
     * @param string|null $id Brand Discount id.
开发者ID:kamleshethos,项目名称:ethos-navision,代码行数:31,代码来源:BrandDiscountsController.php

示例15:

 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link      http://cakephp.org CakePHP(tm) Project
 * @since     0.2.9
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace App\Controller;

use Cake\Controller\Controller;
use Cake\Event\Event;
use Cake\I18n\Time;
Time::$defaultLocale = 'es-ES';
Time::setToStringFormat('dd-MM-YYYY');
/**
 * Application Controller
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @link http://book.cakephp.org/3.0/en/controllers.html#the-app-controller
 */
class AppController extends Controller
{
    /**
     * Initialization hook method.
     *
     * Use this method to add common initialization code like loading components.
     *
开发者ID:checopato,项目名称:Lighthouse-3.1.7,代码行数:31,代码来源:AppController.php


注:本文中的Cake\I18n\Time::setToStringFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。