Server IP : 172.67.216.182 / Your IP : 162.158.88.43 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/lapma.in/phpMyAdmin/vendor/thecodingmachine/safe/lib/ |
Upload File : |
<?php namespace Safe; use DateInterval; use DateTimeInterface; use DateTimeZone; use Safe\Exceptions\DatetimeException; /** this class implements a safe version of the Datetime class */ class DateTime extends \DateTime { //switch from regular datetime to safe version private static function createFromRegular(\DateTime $datetime): self { return new self($datetime->format('Y-m-d H:i:s.u'), $datetime->getTimezone()); } /** * @param string $format * @param string $time * @param DateTimeZone|null $timezone * @throws DatetimeException */ public static function createFromFormat($format, $time, $timezone = null): self { $datetime = parent::createFromFormat($format, $time, $timezone); if ($datetime === false) { throw DatetimeException::createFromPhpError(); } return self::createFromRegular($datetime); } /** * @param DateTimeInterface $datetime2 The date to compare to. * @param boolean $absolute [optional] Whether to return absolute difference. * @return DateInterval The DateInterval object representing the difference between the two dates. * @throws DatetimeException */ public function diff($datetime2, $absolute = false): DateInterval { /** @var \DateInterval|false $result */ $result = parent::diff($datetime2, $absolute); if ($result === false) { throw DatetimeException::createFromPhpError(); } return $result; } /** * @param string $modify A date/time string. Valid formats are explained in <a href="https://secure.php.net/manual/en/datetime.formats.php">Date and Time Formats</a>. * @return DateTime Returns the DateTime object for method chaining. * @throws DatetimeException */ public function modify($modify): self { /** @var DateTime|false $result */ $result = parent::modify($modify); if ($result === false) { throw DatetimeException::createFromPhpError(); } return $result; } /** * @param int $year * @param int $month * @param int $day * @return DateTime * @throws DatetimeException */ public function setDate($year, $month, $day): self { /** @var DateTime|false $result */ $result = parent::setDate($year, $month, $day); if ($result === false) { throw DatetimeException::createFromPhpError(); } return $result; } }