本文整理汇总了PHP中Math::ffloor方法的典型用法代码示例。如果您正苦于以下问题:PHP Math::ffloor方法的具体用法?PHP Math::ffloor怎么用?PHP Math::ffloor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math
的用法示例。
在下文中一共展示了Math::ffloor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: snapWeek
static function snapWeek($dt, $direction, $required)
{
$current = datetime__DateTime_DateTime_Impl_::getWeekDay($dt, null);
$days = Math::ffloor(($dt - 62135596800.0) / 86400);
switch ($direction) {
case -1:
$diff = null;
if ($current >= $required) {
$diff = $current - $required;
} else {
$diff = $current + 7 - $required;
}
return ($days - $diff) * 86400;
break;
case 1:
$diff1 = null;
if ($required > $current) {
$diff1 = $required - $current;
} else {
$diff1 = $required + 7 - $current;
}
return ($days + $diff1) * 86400;
break;
case 0:
$diff2 = null;
if ($current >= $required) {
$diff2 = $current - $required;
} else {
$diff2 = $current + 7 - $required;
}
$previous = ($days - $diff2) * 86400;
$diff3 = null;
if ($required > $current) {
$diff3 = $required - $current;
} else {
$diff3 = $required + 7 - $current;
}
$next = ($days + $diff3) * 86400;
if ($next - ($dt - 62135596800.0) > $dt - 62135596800.0 - $previous) {
return $previous;
} else {
return $next;
}
break;
}
}
示例2: toString
static function toString($this1)
{
$Y = datetime__DateTime_DateTime_Impl_::getYear($this1);
$M = null;
$days = Std::int(($this1 - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($this1)) / 86400) + 1;
$M = datetime_utils_DateTimeMonthUtils::getMonth($days, datetime__DateTime_DateTime_Impl_::isLeapYear($this1));
$D = null;
$days1 = Std::int(($this1 - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($this1)) / 86400) + 1;
$D = datetime_utils_DateTimeMonthUtils::getMonthDay($days1, datetime__DateTime_DateTime_Impl_::isLeapYear($this1));
$h = Std::int(($this1 - Math::ffloor($this1 / 86400) * 86400) / 3600);
$m = Std::int(($this1 - Math::ffloor($this1 / 3600) * 3600) / 60);
$s = Std::int($this1 - Math::ffloor($this1 / 60) * 60);
return "" . _hx_string_rec($Y, "") . "-" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__4($D, $M, $Y, $h, $m, $s, $this1)) . "-" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__5($D, $M, $Y, $h, $m, $s, $this1)) . " " . _hx_string_or_null(datetime__DateTime_DateTime_Impl__6($D, $M, $Y, $h, $m, $s, $this1)) . ":" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__7($D, $M, $Y, $h, $m, $s, $this1)) . ":" . _hx_string_or_null(datetime__DateTime_DateTime_Impl__8($D, $M, $Y, $h, $m, $s, $this1));
}
示例3: strftime
static function strftime($dt, $format)
{
$prevPos = 0;
$pos = _hx_index_of($format, "%", null);
$str = "";
while ($pos >= 0) {
$str .= _hx_string_or_null(_hx_substring($format, $prevPos, $pos));
$pos++;
$_g = ord(substr($format, $pos, 1));
switch ($_g) {
case 100:
$s = null;
$s = _hx_string_rec(datetime_utils_DateTimeUtils_5($_g, $dt, $format, $pos, $prevPos, $s, $str), "") . "";
if (strlen("0") === 0 || strlen($s) >= 2) {
$str .= _hx_string_or_null($s);
} else {
$str .= _hx_string_or_null(str_pad($s, Math::ceil((2 - strlen($s)) / strlen("0")) * strlen("0") + strlen($s), "0", STR_PAD_LEFT));
}
break;
case 101:
$s1 = null;
$s1 = _hx_string_rec(datetime_utils_DateTimeUtils_6($_g, $dt, $format, $pos, $prevPos, $s1, $str), "") . "";
if (strlen(" ") === 0 || strlen($s1) >= 2) {
$str .= _hx_string_or_null($s1);
} else {
$str .= _hx_string_or_null(str_pad($s1, Math::ceil((2 - strlen($s1)) / strlen(" ")) * strlen(" ") + strlen($s1), " ", STR_PAD_LEFT));
}
break;
case 106:
$day = Std::int(($dt - 62135596800.0 - datetime__DateTime_DateTime_Impl_::yearStart($dt)) / 86400) + 1;
$s2 = "" . _hx_string_rec($day, "");
if (strlen("0") === 0 || strlen($s2) >= 3) {
$str .= _hx_string_or_null($s2);
} else {
$str .= _hx_string_or_null(str_pad($s2, Math::ceil((3 - strlen($s2)) / strlen("0")) * strlen("0") + strlen($s2), "0", STR_PAD_LEFT));
}
break;
case 117:
$str .= _hx_string_rec(datetime__DateTime_DateTime_Impl_::getWeekDay($dt, true), "") . "";
break;
case 119:
$str .= _hx_string_rec(datetime__DateTime_DateTime_Impl_::getWeekDay($dt, null), "") . "";
break;
case 109:
$s3 = null;
$s3 = _hx_string_rec(datetime_utils_DateTimeUtils_7($_g, $dt, $format, $pos, $prevPos, $s3, $str), "") . "";
if (strlen("0") === 0 || strlen($s3) >= 2) {
$str .= _hx_string_or_null($s3);
} else {
$str .= _hx_string_or_null(str_pad($s3, Math::ceil((2 - strlen($s3)) / strlen("0")) * strlen("0") + strlen($s3), "0", STR_PAD_LEFT));
}
break;
case 67:
$s4 = _hx_string_rec(Std::int(datetime__DateTime_DateTime_Impl_::getYear($dt) / 100), "") . "";
if (strlen("0") === 0 || strlen($s4) >= 2) {
$str .= _hx_string_or_null($s4);
} else {
$str .= _hx_string_or_null(str_pad($s4, Math::ceil((2 - strlen($s4)) / strlen("0")) * strlen("0") + strlen($s4), "0", STR_PAD_LEFT));
}
break;
case 121:
$s5 = _hx_substr(_hx_string_rec(datetime__DateTime_DateTime_Impl_::getYear($dt), "") . "", -2, null);
if (strlen("0") === 0 || strlen($s5) >= 2) {
$str .= _hx_string_or_null($s5);
} else {
$str .= _hx_string_or_null(str_pad($s5, Math::ceil((2 - strlen($s5)) / strlen("0")) * strlen("0") + strlen($s5), "0", STR_PAD_LEFT));
}
break;
case 89:
$str .= _hx_string_rec(datetime__DateTime_DateTime_Impl_::getYear($dt), "") . "";
break;
case 86:
$s6 = _hx_string_rec(datetime__DateTime_DateTime_Impl_::getWeek($dt), "") . "";
if (strlen("0") === 0 || strlen($s6) >= 2) {
$str .= _hx_string_or_null($s6);
} else {
$str .= _hx_string_or_null(str_pad($s6, Math::ceil((2 - strlen($s6)) / strlen("0")) * strlen("0") + strlen($s6), "0", STR_PAD_LEFT));
}
break;
case 72:
$s7 = _hx_string_rec(Std::int(($dt - Math::ffloor($dt / 86400) * 86400) / 3600), "") . "";
if (strlen("0") === 0 || strlen($s7) >= 2) {
$str .= _hx_string_or_null($s7);
} else {
$str .= _hx_string_or_null(str_pad($s7, Math::ceil((2 - strlen($s7)) / strlen("0")) * strlen("0") + strlen($s7), "0", STR_PAD_LEFT));
}
break;
case 107:
$s8 = _hx_string_rec(Std::int(($dt - Math::ffloor($dt / 86400) * 86400) / 3600), "") . "";
if (strlen(" ") === 0 || strlen($s8) >= 2) {
$str .= _hx_string_or_null($s8);
} else {
$str .= _hx_string_or_null(str_pad($s8, Math::ceil((2 - strlen($s8)) / strlen(" ")) * strlen(" ") + strlen($s8), " ", STR_PAD_LEFT));
}
break;
case 73:
$s9 = _hx_string_rec(datetime__DateTime_DateTime_Impl_::getHour12($dt), "") . "";
if (strlen("0") === 0 || strlen($s9) >= 2) {
$str .= _hx_string_or_null($s9);
} else {
//.........这里部分代码省略.........
示例4: getSeconds
public function getSeconds()
{
if ($this->seconds < 0) {
$secondBegin = null;
$this1 = $this->begin;
$secondBegin = Std::int($this1 - Math::ffloor($this1 / 60) * 60);
$secondEnd = null;
$this2 = $this->end;
$secondEnd = Std::int($this2 - Math::ffloor($this2 / 60) * 60);
if ($secondBegin <= $secondEnd) {
$this->seconds = $secondEnd - $secondBegin;
} else {
$this->seconds = 60 - $secondBegin + $secondEnd;
}
}
return $this->seconds;
}
示例5: suncalc_SunCalc_0
function suncalc_SunCalc_0(&$date, &$inUTC, &$lat, &$lng)
{
$time = Math::ffloor($date->getTime() / 1000);
return $time + 62135596800.0;
}