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


PHP Carbon::setToStringFormat方法代码示例

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


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

示例1: __construct

 /**
  * Create a new command instance.
  *
  * @return void
  */
 public function __construct(TrackingRepository $trackingRepo, BillboardRepository $billboardRepo)
 {
     parent::__construct();
     $this->trackingRepository = $trackingRepo;
     $this->billboardRepository = $billboardRepo;
     Carbon::setToStringFormat('Y_m');
 }
开发者ID:sagaciresearch,项目名称:adtracking,代码行数:12,代码来源:GenerateTrackings.php

示例2: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     \Carbon\Carbon::setToStringFormat('d/m/Y');
     view()->composer('admin.templates.principal', function ($view) {
         $view->with('usuario', auth()->user());
     });
 }
开发者ID:giordanolima,项目名称:laravel-adminlte,代码行数:12,代码来源:AppServiceProvider.php

示例3: testResetToStringFormat

 public function testResetToStringFormat()
 {
     $d = Carbon::now();
     Carbon::setToStringFormat('123');
     Carbon::resetToStringFormat();
     $this->assertSame($d->toDateTimeString(), '' . $d);
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:7,代码来源:StringsTest.php

示例4: __construct

 public function __construct(array $data)
 {
     if (class_exists('\\Carbon\\Carbon')) {
         $format = 'D, d M o H:i:s e';
         \Carbon\Carbon::setToStringFormat($format);
     }
     parent::__construct($data);
 }
开发者ID:swader,项目名称:diffbot-php-client,代码行数:8,代码来源:Post.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $locale = $request->cookie('locale', Config::get('app.locale'));
     App::setLocale($locale);
     Carbon::setLocale($locale);
     Carbon::setToStringFormat('Y-m-d H:i:s');
     return $next($request);
 }
开发者ID:hramose,项目名称:Laravel5AdminUsersRoles,代码行数:15,代码来源:Locale.php

示例6: feedhistory

function feedhistory($connection = 'default', $limit)
{
    $annotations = Annotation::on($connection)->with('Attachments')->where('id', '<', $limit)->orderBy('id', 'desc')->take(20)->get();
    Carbon::setToStringFormat(DateTime::ISO8601);
    $result = [];
    foreach ($annotations as $annotation) {
        $result[] = json_decode($annotation->toJson());
    }
    return json_encode($result);
}
开发者ID:BitPrepared,项目名称:OnlineOnsiteOngoing,代码行数:10,代码来源:functions.feed.php

示例7: __construct

 public function __construct(array $data)
 {
     if (class_exists('\\Carbon\\Carbon')) {
         $format = 'D, d M o H:i:s e';
         \Carbon\Carbon::setToStringFormat($format);
     }
     parent::__construct($data);
     if (isset($this->data['discussion'])) {
         $this->discussion = new Discussion($this->data['discussion']);
     }
 }
开发者ID:swader,项目名称:diffbot-php-client,代码行数:11,代码来源:Article.php

示例8: __construct

 public function __construct($data = null, $status = 200, $headers = array(), $options = 0)
 {
     if ($data instanceof \Exception) {
         $data = array("code" => $data->getCode(), "error" => $data->getMessage());
     } else {
         // move the prepare function here
         Carbon::setToStringFormat('Y-m-d\\TH:i:s.z\\Z');
         $data = ParseHelper::prepareResponse($data);
     }
     parent::__construct($data, $status, $headers, $options);
 }
开发者ID:malimu,项目名称:baas,代码行数:11,代码来源:ParseResponse.php

示例9: getCheck

 public function getCheck()
 {
     $meds = \WQS\Medication::all();
     foreach ($meds as $med) {
         $taken = Carbon::parse($med->last_taken);
         if ($med->interval < Carbon::now()->diffInHours($taken)) {
             $med->can_take = 1;
         }
         Carbon::setToStringFormat('g:i a');
         $med->next = $taken->addHours($med->interval);
     }
     return view('med-check')->with('meds', $meds);
 }
开发者ID:practicalmess,项目名称:wqstracker,代码行数:13,代码来源:MedicationsController.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     // Also set locale per request
     app()->setLocale($this->auth->user()->locale);
     // And set default string format for dates
     Carbon::setToStringFormat('j-M-Y h:i A');
     return $next($request);
 }
开发者ID:ariefristyanto,项目名称:fleetmanagement,代码行数:22,代码来源:Authenticate.php

示例11: getAllMessages

 public function getAllMessages()
 {
     try {
         Carbon::setToStringFormat(self::PLUGIN_DATE_FORMAT);
         $date_from = Carbon::now()->subMonth()->toDateString();
         $date_to = Carbon::now()->toDateString();
         $mandrill = new Mandrill($this->getSetting('MandrillApiKey'));
         $result = $mandrill->messages->search('*', $date_from, $date_to);
     } catch (Mandrill_Error $e) {
         // Mandrill errors are thrown as exceptions
         // echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
         // A mandrill error occurred: Mandrill_ServiceUnavailable - Service Temporarily Unavailable
         throw $e;
     }
     return $result;
 }
开发者ID:WHITEdevelopment,项目名称:craft-mandrill,代码行数:16,代码来源:Mandrill_MessageService.php

示例12: getAttributeValue

 /**
  * Get a plain attribute (not a relationship).
  *
  * @param  string  $key
  * @return mixed
  */
 protected function getAttributeValue($key)
 {
     $value = $this->getAttributeFromArray($key);
     // If the attribute has a get mutator, we will call that then return what
     // it returns as the value, which is useful for transforming values on
     // retrieval from the model to a form that is more useful for usage.
     if ($this->hasGetMutator($key)) {
         return $this->mutateAttribute($key, $value);
     } elseif (in_array($key, $this->getDateField())) {
         if ($value) {
             Carbon::setToStringFormat('d-m-Y');
             return (new Carbon($value, 'US/Eastern'))->setTimezone('Asia/Kuala_Lumpur');
         }
     } elseif (in_array($key, $this->getDateTimeField())) {
         if ($value) {
             Carbon::setToStringFormat('d-m-Y H:i:s');
             return (new Carbon($value, 'US/Eastern'))->setTimezone('Asia/Kuala_Lumpur');
         }
     }
     return $value;
 }
开发者ID:sairiz,项目名称:larafuse,代码行数:27,代码来源:BaseTable.php

示例13: doRun

 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $name = $this->getCommandName($input);
     // Did the user enter an environment option?
     if (true === $input->hasParameterOption(['--env', '-e'])) {
         $this->environment = $input->getParameterOption(['--env', '-e']);
     } else {
         if ($name === 'publish') {
             $this->environment = 'production';
         }
     }
     // Load config
     $this->config = new Config($this->environment);
     // Set local timezone
     date_default_timezone_set($this->getSetting('timezone', 'America/New_York'));
     // Set default date format
     Carbon::setToStringFormat($this->config->get('date_format', 'Y-m-d H:i:s'));
     // Register events
     $this->registerEvents();
     return parent::doRun($input, $output);
 }
开发者ID:torann,项目名称:skosh-generator,代码行数:29,代码来源:Application.php

示例14: __construct

 public function __construct()
 {
     $this->query = \App\Statcache::Week()->get();
     \Carbon\Carbon::setToStringFormat('d/m/Y');
 }
开发者ID:Qeenslet,项目名称:elite-lara,代码行数:5,代码来源:charterModer.php

示例15: __construct

 /**
  * Create a new command instance.
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     Carbon::setToStringFormat('Y_m');
 }
开发者ID:sagaciresearch,项目名称:adtracking,代码行数:10,代码来源:GenerateTrackingsImagesURL.php


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