4 public function __construct(){}
5 static function format($d, $f) {
6 return strftime($f, $d->__t);
8 static function delta($d, $t) {
9 return Date::fromTime($d->getTime() + $t);
11 static $DAYS_OF_MONTH;
12 static function getMonthDays($d) {
13 $month = $d->getMonth();
14 $year = $d->getFullYear();
16 return DateTools::$DAYS_OF_MONTH[$month];
18 $isB = _hx_mod($year, 4) === 0 && _hx_mod($year, 100) !== 0 || _hx_mod($year, 400) === 0;
19 return (($isB) ? 29 : 28);
21 static function seconds($n) {
24 static function minutes($n) {
25 return $n * 60.0 * 1000.0;
27 static function hours($n) {
28 return $n * 60.0 * 60.0 * 1000.0;
30 static function days($n) {
31 return $n * 24.0 * 60.0 * 60.0 * 1000.0;
33 static function parse($t) {
37 return _hx_anonymous(array("ms" => _hx_mod($t, 1000), "seconds" => intval(_hx_mod($s, 60)), "minutes" => intval(_hx_mod($m, 60)), "hours" => intval(_hx_mod($h, 24)), "days" => intval($h / 24)));
39 static function make($o) {
40 return $o->ms + 1000.0 * ($o->seconds + 60.0 * ($o->minutes + 60.0 * ($o->hours + 24.0 * $o->days)));
42 function __toString() { return 'DateTools'; }
44 DateTools::$DAYS_OF_MONTH = new _hx_array(array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));