Пример #1
0
 /**
  * Return a timestamp as DateTime object.
  *
  * @param  mixed  $value
  * @return \Carbon\Carbon
  */
 protected function asDateTime($value)
 {
     if ($value instanceof Argon) {
         return $value;
     }
     if ($value instanceof DateTime) {
         return Argon::instance($value);
     }
     if (is_numeric($value)) {
         return Argon::createFromTimestamp($value);
     }
     if (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $value)) {
         return Argon::createFromFormat('Y-m-d', $value)->startOfDay();
     }
     return Argon::createFromFormat($this->getDateFormat(), $value);
 }