@@ 1364-1389 (lines=26) @@ | ||
1361 | * |
|
1362 | * @return int Hour |
|
1363 | */ |
|
1364 | public static function HOUROFDAY($timeValue = 0) |
|
1365 | { |
|
1366 | $timeValue = Functions::flattenSingleValue($timeValue); |
|
1367 | ||
1368 | if (!is_numeric($timeValue)) { |
|
1369 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
1370 | $testVal = strtok($timeValue, '/-: '); |
|
1371 | if (strlen($testVal) < strlen($timeValue)) { |
|
1372 | return Functions::VALUE(); |
|
1373 | } |
|
1374 | } |
|
1375 | $timeValue = self::getTimeValue($timeValue); |
|
1376 | if (is_string($timeValue)) { |
|
1377 | return Functions::VALUE(); |
|
1378 | } |
|
1379 | } |
|
1380 | // Execute function |
|
1381 | if ($timeValue >= 1) { |
|
1382 | $timeValue = fmod($timeValue, 1); |
|
1383 | } elseif ($timeValue < 0.0) { |
|
1384 | return Functions::NAN(); |
|
1385 | } |
|
1386 | $timeValue = Date::excelToTimestamp($timeValue); |
|
1387 | ||
1388 | return (int) gmdate('G', $timeValue); |
|
1389 | } |
|
1390 | ||
1391 | /** |
|
1392 | * MINUTE. |
|
@@ 1405-1430 (lines=26) @@ | ||
1402 | * |
|
1403 | * @return int Minute |
|
1404 | */ |
|
1405 | public static function MINUTE($timeValue = 0) |
|
1406 | { |
|
1407 | $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); |
|
1408 | ||
1409 | if (!is_numeric($timeValue)) { |
|
1410 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
1411 | $testVal = strtok($timeValue, '/-: '); |
|
1412 | if (strlen($testVal) < strlen($timeValue)) { |
|
1413 | return Functions::VALUE(); |
|
1414 | } |
|
1415 | } |
|
1416 | $timeValue = self::getTimeValue($timeValue); |
|
1417 | if (is_string($timeValue)) { |
|
1418 | return Functions::VALUE(); |
|
1419 | } |
|
1420 | } |
|
1421 | // Execute function |
|
1422 | if ($timeValue >= 1) { |
|
1423 | $timeValue = fmod($timeValue, 1); |
|
1424 | } elseif ($timeValue < 0.0) { |
|
1425 | return Functions::NAN(); |
|
1426 | } |
|
1427 | $timeValue = Date::excelToTimestamp($timeValue); |
|
1428 | ||
1429 | return (int) gmdate('i', $timeValue); |
|
1430 | } |
|
1431 | ||
1432 | /** |
|
1433 | * SECOND. |
|
@@ 1446-1471 (lines=26) @@ | ||
1443 | * |
|
1444 | * @return int Second |
|
1445 | */ |
|
1446 | public static function SECOND($timeValue = 0) |
|
1447 | { |
|
1448 | $timeValue = Functions::flattenSingleValue($timeValue); |
|
1449 | ||
1450 | if (!is_numeric($timeValue)) { |
|
1451 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
1452 | $testVal = strtok($timeValue, '/-: '); |
|
1453 | if (strlen($testVal) < strlen($timeValue)) { |
|
1454 | return Functions::VALUE(); |
|
1455 | } |
|
1456 | } |
|
1457 | $timeValue = self::getTimeValue($timeValue); |
|
1458 | if (is_string($timeValue)) { |
|
1459 | return Functions::VALUE(); |
|
1460 | } |
|
1461 | } |
|
1462 | // Execute function |
|
1463 | if ($timeValue >= 1) { |
|
1464 | $timeValue = fmod($timeValue, 1); |
|
1465 | } elseif ($timeValue < 0.0) { |
|
1466 | return Functions::NAN(); |
|
1467 | } |
|
1468 | $timeValue = Date::excelToTimestamp($timeValue); |
|
1469 | ||
1470 | return (int) gmdate('s', $timeValue); |
|
1471 | } |
|
1472 | ||
1473 | /** |
|
1474 | * EDATE. |