Неиспользуемая директория

This commit is contained in:
lopar 2018-02-16 16:14:46 +02:00
parent a93283e18d
commit 35960c5f95
1 changed files with 0 additions and 27 deletions

View File

@ -1,27 +0,0 @@
<?php
namespace Oldcombats;
class DateTime extends \DateTime {
public function __construct($time = "now", $timezone = null) {
if(is_null($timezone)) {
$timezone = new \DateTimeZone("Europe/Moscow");
}
parent::__construct($time, $timezone);
}
public function isDay() {
$now = $this->getTimestamp();
$sunrise = date_sunrise($now, SUNFUNCS_RET_TIMESTAMP);
$sunset = date_sunset($now, SUNFUNCS_RET_TIMESTAMP);
return ($now > $sunrise && $now <= $sunset);
}
public function isNight() {
return (!$this->isDay());
}
public function getTimeOfDay() {
return ($this->isDay() ? 'day' : 'night');
}
}