Example #1
0
 /**
  * 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);
 }
Example #2
0
File: Tika.php Project: egig/tika
 /**
  * @{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');
     }
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 /**
  * 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();
 }
Example #5
0
 /**
  * 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);
 }
Example #6
0
 /**
  * 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;
 }
Example #7
0
 /**
  * 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);
     }
 }
Example #8
0
 /**
  * {@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()));
         }
     }
 }
Example #9
0
 public function __construct($time, $type, $tz)
 {
     parent::__construct($time, $tz);
     $this->calendar_type = $type;
 }
Example #10
0
 /**
  * {@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);
 }
Example #11
0
 /**
  * Create a new instance of this class.
  *
  * @return void
  */
 public function __construct($time = null, $tz = null)
 {
     parent::__construct($time, $tz);
 }
Example #12
0
 public function __construct($time = null, $tz = null, Lookup $lookup = null)
 {
     parent::__construct($time, $tz);
     $this->setLookup($lookup);
 }
Example #13
0
 public function __construct()
 {
     parent::__construct();
 }