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


PHP Carbon::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Returns new DateTime object.
  *
  * @param  string              $time
  * @param  string|DateTimeZone $timezone
  * @return Date
  */
 public function __construct($time = null, $timezone = null)
 {
     // Create Date from timestamp.
     if (is_int($time)) {
         $time = "@{$time}";
     }
     parent::__construct($time, $timezone);
 }
开发者ID:EmilioBravo,项目名称:laravel-date,代码行数:15,代码来源:Date.php

示例2: __construct

 /**
  * @{inheritdoc}
  */
 public function __construct($time = null, $tz = null, $locale = null)
 {
     parent::__construct($time, $tz);
     $this->locale = is_null($locale) ? 'en' : $locale;
     foreach (static::$builtInLanguages as $lang) {
         $this->setLanguageFilePath($lang, __DIR__ . '/l10n/' . $lang . '.php');
     }
 }
开发者ID:egig,项目名称:tika,代码行数:11,代码来源:Tika.php

示例3: __construct

 /**
  * Returns new DateTime object.
  *
  * @param  string  $time
  * @param  string|DateTimeZone  $timezone
  * @return Date
  */
 public function __construct($time = null, $timezone = null)
 {
     // Create Date from timestamp.
     if (is_int($time)) {
         $time = "@{$time}";
     }
     // Get default timezone from app config.
     if (is_null($timezone) and class_exists('Illuminate\\Support\\Facades\\Config')) {
         $timezone = \Illuminate\Support\Facades\Config::get('app.timezone');
     }
     parent::__construct($time, $timezone);
 }
开发者ID:erpio,项目名称:Reportula,代码行数:19,代码来源:Date.php

示例4: __construct

 /**
  * Se o time for string ele aceita o formato TDateTime (d/m/Y H:i:s |d/m/YTH:i:s), não aceita formato americano (m/d/Y H:i:s)
  *
  * @param string|int|DateTime|object $time
  * @param \DateTimeZone|string       $tz
  *
  * @throws DomainException
  */
 public function __construct($time = null, $tz = null)
 {
     if (null !== $time) {
         $date = static::prepareDate($time);
         if (!$date) {
             throw new DomainException("Data {$time} inválida!");
         }
         $time = $date;
     }
     parent::__construct($time, $tz);
     $this->init();
 }
开发者ID:paliari,项目名称:php-date-time,代码行数:20,代码来源:TDateTime.php

示例5: __construct

 /**
  * Create a new DateValue instance.
  *
  * @param DateTimeInterface|string|null $time
  * @param \DateTimeZone|string          $tz
  */
 public function __construct($time = null, $tz = null)
 {
     if ($time instanceof DateTimeInterface) {
         $create_from = $time->format('Y-m-d H:i:s');
     } else {
         $create_from = $time;
     }
     if (empty($tz)) {
         $tz = 'UTC';
     }
     parent::__construct($create_from, $tz);
 }
开发者ID:activecollab,项目名称:datevalue,代码行数:18,代码来源:DateTimeValue.php

示例6: __construct

 /**
  * Create a new Sunny instance.
  *
  * @param string               $time
  * @param DateTimeZone|string  $tz
  * @param float                $latitude
  * @param float                $longitude
  */
 public function __construct($time = null, $tz = null, $latitude = null, $longitude = null)
 {
     parent::__construct($time, $tz);
     $this->setLocation($latitude, $longitude);
     /**
      * According to these sources default date.sunrise_zenith and
      * date.sunset_zenith in php is wrong. So fixing it here.
      * https://bugs.php.net/bug.php?id=49448
      * http://aa.usno.navy.mil/faq/docs/RST_defs.php
      */
     $this->zenith = 90 + 50 / 60;
 }
开发者ID:Braunson,项目名称:Sunny,代码行数:20,代码来源:Sunny.php

示例7: __construct

 /**
  * Returns new DateTime object.
  *
  * @param  string              $time
  * @param  string|DateTimeZone $timezone
  * @return Date
  */
 public function __construct($time = null, $timezone = 'Asia/Bangkok')
 {
     if (is_int($time)) {
         $timestamp = $time;
         $time = null;
     } else {
         $timestamp = null;
     }
     parent::__construct($time, $timezone);
     if ($timestamp !== null) {
         $this->setTimestamp($timestamp);
     }
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:20,代码来源:Date.php

示例8: __construct

 /**
  * {@inheritdoc}
  */
 public function __construct($time = null, $timezone = null)
 {
     if (!self::$init) {
         self::init();
     }
     parent::__construct($time, $timezone);
     if ($timezone) {
         $convert = is_string($timezone) && $timezone != date_default_timezone_get();
         $convert = $timezone instanceof \DateTimeZone && $timezone->getName() != date_default_timezone_get() ? true : $convert;
         if ($convert) {
             $this->setTimezone(new \DateTimeZone(date_default_timezone_get()));
         }
     }
 }
开发者ID:cawaphp,项目名称:cawa,代码行数:17,代码来源:DateTime.php

示例9: __construct

 public function __construct($time, $type, $tz)
 {
     parent::__construct($time, $tz);
     $this->calendar_type = $type;
 }
开发者ID:sukohi,项目名称:ceasar,代码行数:5,代码来源:Calendar.php

示例10: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct($time = null, $tz = null)
 {
     if ($time instanceof \DateTime) {
         list($time, $tz) = [$time->format('Y-m-d H:i:s'), $time->getTimeZone()];
     }
     if (is_numeric($time)) {
         $time = '@' . $time;
     }
     parent::__construct($time, $tz);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:13,代码来源:Time.php

示例11: __construct

 /**
  * Create a new instance of this class.
  *
  * @return void
  */
 public function __construct($time = null, $tz = null)
 {
     parent::__construct($time, $tz);
 }
开发者ID:dascentral,项目名称:rma,代码行数:9,代码来源:Willard.php

示例12: __construct

 public function __construct($time = null, $tz = null, Lookup $lookup = null)
 {
     parent::__construct($time, $tz);
     $this->setLookup($lookup);
 }
开发者ID:brianwalden,项目名称:sas,代码行数:5,代码来源:Temporal.php

示例13: __construct

 public function __construct()
 {
     parent::__construct();
 }
开发者ID:shareany,项目名称:luckyphp,代码行数:4,代码来源:Datetime.php


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