4 public function __construct($year, $month, $day, $hour, $min, $sec) {
5 if(!php_Boot::$skip_constructor) {
6 $this->__t = mktime($hour, $min, $sec, $month + 1, $day, $year);
8 public function toString() {
9 return date("Y-m-d H:i:s", $this->__t);
11 public function getDay() {
12 return intval(date("w", $this->__t));
14 public function getSeconds() {
15 return intval(date("s", $this->__t));
17 public function getMinutes() {
18 return intval(date("i", $this->__t));
20 public function getHours() {
21 return intval(date("G", $this->__t));
23 public function getDate() {
24 return intval(date("j", $this->__t));
26 public function getMonth() {
27 $m = intval(date("n", $this->__t));
30 public function getFullYear() {
31 return intval(date("Y", $this->__t));
33 public function getPhpTime() {
36 public function getTime() {
37 return $this->__t * 1000;
40 public function __call($m, $a) {
41 if(isset($this->$m) && is_callable($this->$m))
42 return call_user_func_array($this->$m, $a);
43 else if(isset($this->»dynamics[$m]) && is_callable($this->»dynamics[$m]))
44 return call_user_func_array($this->»dynamics[$m], $a);
45 else if('toString' == $m)
46 return $this->__toString();
48 throw new HException('Unable to call «'.$m.'»');
50 static function now() {
51 return Date::fromPhpTime(round(microtime(true), 3));
53 static function fromPhpTime($t) {
54 $d = new Date(2000, 1, 1, 0, 0, 0);
58 static function fromTime($t) {
59 $d = new Date(2000, 1, 1, 0, 0, 0);
63 static function fromString($s) {
64 return Date::fromPhpTime(strtotime($s));
66 function __toString() { return $this->toString(); }