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


PHP DateTimeImmutable::getTimezone方法代码示例

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


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

示例1: unserialize

 /**
  * @param  \stdClass $obj
  * @param  array     $context
  * @return TwitterEvent
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     $createdAt = new \DateTimeImmutable($obj->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return TwitterEvent::create($obj->event, $this->userSerializer->unserialize($obj->source), isset($obj->target) ? $this->userSerializer->unserialize($obj->target) : null, isset($obj->target_object) ? $this->targetSerializer->unserialize($obj->target_object) : null, $createdAt);
 }
开发者ID:remi-san,项目名称:twitter,代码行数:12,代码来源:TwitterEventSerializer.php

示例2: unserialize

 /**
  * @param  \stdClass $obj
  * @param  array     $context
  * @return \Twitter\Object\Tweet
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     $createdAt = new \DateTimeImmutable($obj->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return Tweet::create(TwitterMessageId::create($obj->id), $this->userSerializer->unserialize($obj->user), $obj->text, $obj->lang, $createdAt, $obj->entities ? $this->twitterEntitiesSerializer->unserialize($obj->entities) : TwitterEntities::create(), $obj->coordinates ? $this->coordinatesSerializer->unserialize($obj->coordinates) : null, $obj->place ? $this->placeSerializer->unserialize($obj->place) : null, $obj->in_reply_to_status_id, $obj->in_reply_to_user_id, $obj->in_reply_to_screen_name, $obj->retweeted, $obj->retweet_count, $obj->favorited, $obj->favorite_count, $obj->truncated, $obj->source, isset($obj->retweeted_status) ? $this->unserialize($obj->retweeted_status) : null);
 }
开发者ID:remi-san,项目名称:twitter,代码行数:12,代码来源:TweetSerializer.php

示例3: unserialize

 /**
  * @param  \stdClass $directMessage
  * @param  array     $context
  * @return TwitterDirectMessage
  */
 public function unserialize($directMessage, array $context = [])
 {
     Assertion::true($this->canUnserialize($directMessage), 'object is not unserializable');
     $dm = $directMessage->direct_message;
     $createdAt = new \DateTimeImmutable($dm->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return TwitterDirectMessage::create(TwitterMessageId::create($dm->id), $this->userSerializer->unserialize($dm->sender), $this->userSerializer->unserialize($dm->recipient), $dm->text, $createdAt, $this->twitterEntitiesSerializer->canUnserialize($dm->entities) ? $this->twitterEntitiesSerializer->unserialize($dm->entities) : TwitterEntities::create());
 }
开发者ID:remi-san,项目名称:twitter,代码行数:13,代码来源:TwitterDirectMessageSerializer.php

示例4: ago

 /**
  * @param boolean $ago Do we add 'ago' to interval.
  *
  * @return string
  * @since 2015-08-07
  */
 public function ago($ago = true)
 {
     $l = $this->lang;
     $s = $l->seperator();
     $to = $this->to;
     if ($to === null) {
         $to = new \DateTimeImmutable('now', $this->from->getTimezone());
     }
     $int = $this->from->diff($to);
     $ret = $l->format($int, $ago);
     return $ret;
 }
开发者ID:ofbeaton,项目名称:php-timeago,代码行数:18,代码来源:Timeago.php

示例5: setExpires

 public function setExpires($expires)
 {
     if ($expires === NULL) {
         $this->expires = NULL;
     } else {
         if (is_numeric($expires)) {
             $expires = new \DateTimeImmutable('@' . $expires);
         } elseif ($expires instanceof \DateTimeInterface) {
             $expires = new \DateTimeImmutable('@' . $expires->getTimestamp(), $expires->getTimezone());
         } else {
             $expires = \DateTimeImmutable::createFromFormat(Http::DATE_COOKIE, $expires);
         }
         $this->expires = $expires->setTimezone(new \DateTimeZone('UTC'));
     }
 }
开发者ID:koolkode,项目名称:http,代码行数:15,代码来源:SetCookieHeader.php

示例6: hasExpired

 /**
  * @return bool TRUE if the token has expired (and is invalid); FALSE otherwise.
  */
 public function hasExpired() : bool
 {
     return $this->expires <= new \DateTimeImmutable('now', $this->expires->getTimezone());
 }
开发者ID:php-opencloud,项目名称:openstack,代码行数:7,代码来源:Token.php

示例7: getTimezone

 /**
  * {@inheritdoc}
  */
 public function getTimezone()
 {
     return $this->prototype->getTimezone();
 }
开发者ID:kdyby,项目名称:clock,代码行数:7,代码来源:AbstractProvider.php


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