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


PHP Carbon::toIso8601String方法代码示例

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


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

示例1: getTrialEndForUpdate

 /**
  * Get the trial end timestamp for a Conekta subscription update.
  *
  * @return int
  */
 protected function getTrialEndForUpdate()
 {
     if ($this->skipTrial) {
         return Carbon::now()->toIso8601String();
     }
     return $this->trialEnd ? $this->trialEnd->toIso8601String() : null;
 }
开发者ID:dinkbit,项目名称:conekta-cashier,代码行数:12,代码来源:ConektaGateway.php

示例2: __invoke

 /**
  * __invoke
  *
  * Summaries for methods should use 3rd person declarative rather
  * than 2nd person imperative, beginning with a verb phrase.
  *
  * @param mixed $date   DESCRIPTION
  * @param mixed $attr   DESCRIPTION
  * @param mixed $format DESCRIPTION
  *
  * @return mixed
  *
  * @access public
  */
 public function __invoke($date, $attr = [], $format = null)
 {
     $date = new Carbon($date);
     $attr = array_merge_recursive($attr, ['datetime' => $date->toIso8601String()]);
     $content = $format ? $date->format($format) : $date->toDayDateTimeString();
     return parent::__invoke($content, $attr, $this->tag);
 }
开发者ID:jnjxp,项目名称:html-format,代码行数:21,代码来源:AbstractDateHelper.php

示例3: validateTimestamp

 private function validateTimestamp($timestamp)
 {
     if ($timestamp instanceof Carbon) {
         $carbon = $timestamp;
     } else {
         if ($timestamp instanceof DateTime) {
             $carbon = Carbon::instance($timestamp);
         } else {
             if (is_string($timestamp) && strtotime($timestamp) !== false) {
                 $carbon = new Carbon($timestamp);
             } else {
                 throw new \InvalidArgumentException('Invalid date/time format.');
             }
         }
     }
     $this->timestamp = $carbon->toIso8601String();
 }
开发者ID:sevenpixels,项目名称:forecast,代码行数:17,代码来源:Fx.php

示例4: getCreatedAtAttribute

 public function getCreatedAtAttribute($value)
 {
     $dt = new Carbon($value);
     return $dt->toIso8601String();
 }
开发者ID:dukenicols,项目名称:ReviewSystem,代码行数:5,代码来源:Review.php

示例5: createReminder

 /**
  * タスクにリマインダーを設定する
  *
  * @param array $task 1タスクを表す配列
  * @param Carbon $date リマインダー設定日時
  */
 private function createReminder($task, Carbon $date)
 {
     $newReminder['task_id'] = $task['id'];
     $newReminder['date'] = $date->toIso8601String();
     $url = 'a.wunderlist.com/api/v1/reminders';
     $this->poster->post($url, $newReminder, $this->tokens);
 }
开发者ID:HiroKws,项目名称:zakkuto-laravel-hub-site,代码行数:13,代码来源:CopyEverydayTasks.php

示例6: getTimestampAttribute

 public function getTimestampAttribute()
 {
     $date = new Carbon($this->attributes['timestamp'], 'Asia/Bangkok');
     return $date->toIso8601String();
 }
开发者ID:BooMamoo,项目名称:server,代码行数:5,代码来源:Convert.php

示例7: castAttribute

 /**
  * Cast an attribute from a PHP type.
  *
  * @param $castTypes
  * @param $key
  * @param $value
  * @return mixed
  * @internal param BaseModel $model
  * @internal param $object
  */
 private function castAttribute($castTypes, $key, $value)
 {
     if (!array_key_exists($key, $castTypes)) {
         return $value;
     }
     $castType = $castTypes[$key];
     if ($value && in_array($castType, ['date', 'datetime'])) {
         $date = new Carbon($value);
         switch ($castType) {
             case 'date':
                 return $date->format('Y-m-d');
             default:
                 return $date->toIso8601String();
         }
     }
     return $value;
 }
开发者ID:spira,项目名称:api-core,代码行数:27,代码来源:EloquentModelTransformer.php


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